Skip to content

Commit 4e9ad03

Browse files
committed
Merge tag 'acpi-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "These include a couple of fixes, a new ACPI backlight quirk for Apple MacbookPro11,2 and Air7,2 and a bunch of cleanups: - Fix _CPC register setting issue for registers located in memory in the ACPI CPPC library code (Lifeng Zheng) - Use DEFINE_SIMPLE_DEV_PM_OPS in the ACPI battery driver, make it use devm_ for initializing mutexes and allocating driver data, and make it check the register_pm_notifier() return value (Thomas Weißschuh, Andy Shevchenko) - Make the ACPI EC driver support compile-time conditional and allow ACPI to be built without CONFIG_HAS_IOPORT (Arnd Bergmann) - Remove a redundant error check from the pfr_telemetry driver (Colin Ian King) - Rearrange the processor_perflib code in the ACPI processor driver to avoid compiling x86-specific code on other architectures (Arnd Bergmann) - Add adev NULL check to acpi_quirk_skip_serdev_enumeration() and make UART skip quirks work on PCI UARTs without an UID (Hans de Goede) - Force native backlight handling Apple MacbookPro11,2 and Air7,2 in the ACPI video driver (Jonathan Denose) - Switch several ACPI platform drivers back to using struct platform_driver::remove() (Uwe Kleine-König) - Replace strcpy() with strscpy() in multiple places in the ACPI subsystem (Muhammad Qasim Abdul Majeed, Abdul Rahim)" * tag 'acpi-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (24 commits) ACPI: video: force native for Apple MacbookPro11,2 and Air7,2 ACPI: CPPC: Fix _CPC register setting issue ACPI: Switch back to struct platform_driver::remove() ACPI: x86: Add adev NULL check to acpi_quirk_skip_serdev_enumeration() ACPI: x86: Make UART skip quirks work on PCI UARTs without an UID ACPI: allow building without CONFIG_HAS_IOPORT ACPI: processor_perflib: extend X86 dependency ACPI: scan: Use strscpy() instead of strcpy() ACPI: SBSHC: Use strscpy() instead of strcpy() ACPI: SBS: Use strscpy() instead of strcpy() ACPI: power: Use strscpy() instead of strcpy() ACPI: pci_root: Use strscpy() instead of strcpy() ACPI: pci_link: Use strscpy() instead of strcpy() ACPI: event: Use strscpy() instead of strcpy() ACPI: EC: Use strscpy() instead of strcpy() ACPI: APD: Use strscpy() instead of strcpy() ACPI: thermal: Use strscpy() instead of strcpy() ACPI: battery: Check for error code from devm_mutex_init() call ACPI: EC: make EC support compile-time conditional ACPI: pfr_telemetry: remove redundant error check on ret ...
2 parents cd7fa3e + d47a60e commit 4e9ad03

38 files changed

+189
-101
lines changed

drivers/acpi/Kconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,17 @@ config ACPI_REV_OVERRIDE_POSSIBLE
132132
makes it possible to force the kernel to return "5" as the supported
133133
ACPI revision via the "acpi_rev_override" command line switch.
134134

135+
config ACPI_EC
136+
bool "Embedded Controller"
137+
depends on HAS_IOPORT
138+
default X86
139+
help
140+
This driver handles communication with the microcontroller
141+
on many x86 laptops and other machines.
142+
135143
config ACPI_EC_DEBUGFS
136144
tristate "EC read/write access through /sys/kernel/debug/ec"
145+
depends on ACPI_EC
137146
help
138147
Say N to disable Embedded Controller /sys/kernel/debug interface
139148

@@ -433,7 +442,7 @@ config ACPI_HOTPLUG_IOAPIC
433442

434443
config ACPI_SBS
435444
tristate "Smart Battery System"
436-
depends on X86
445+
depends on X86 && ACPI_EC
437446
select POWER_SUPPLY
438447
help
439448
This driver supports the Smart Battery System, another

drivers/acpi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ acpi-y += resource.o
4141
acpi-y += acpi_processor.o
4242
acpi-y += processor_core.o
4343
acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
44-
acpi-y += ec.o
44+
acpi-$(CONFIG_ACPI_EC) += ec.o
4545
acpi-$(CONFIG_ACPI_DOCK) += dock.o
4646
acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o
4747
obj-$(CONFIG_ACPI_MCFG) += pci_mcfg.o

drivers/acpi/ac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void acpi_ac_remove(struct platform_device *pdev)
290290

291291
static struct platform_driver acpi_ac_driver = {
292292
.probe = acpi_ac_probe,
293-
.remove_new = acpi_ac_remove,
293+
.remove = acpi_ac_remove,
294294
.driver = {
295295
.name = "ac",
296296
.acpi_match_table = ac_device_ids,

drivers/acpi/acpi_apd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)
8686
if (!clk_data->name)
8787
return -ENOMEM;
8888

89-
strcpy(clk_data->name, obj->string.pointer);
89+
strscpy(clk_data->name, obj->string.pointer, obj->string.length);
9090
} else {
9191
/* Set default name to mclk if entry missing in firmware */
9292
clk_data->name = "mclk";

drivers/acpi/acpi_pad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ MODULE_DEVICE_TABLE(acpi, pad_device_ids);
462462

463463
static struct platform_driver acpi_pad_driver = {
464464
.probe = acpi_pad_probe,
465-
.remove_new = acpi_pad_remove,
465+
.remove = acpi_pad_remove,
466466
.driver = {
467467
.dev_groups = acpi_pad_groups,
468468
.name = "processor_aggregator",

drivers/acpi/acpi_tad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static struct platform_driver acpi_tad_driver = {
684684
.acpi_match_table = acpi_tad_ids,
685685
},
686686
.probe = acpi_tad_probe,
687-
.remove_new = acpi_tad_remove,
687+
.remove = acpi_tad_remove,
688688
};
689689
MODULE_DEVICE_TABLE(acpi, acpi_tad_ids);
690690

drivers/acpi/apei/einj-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static struct platform_device *einj_dev;
880880
* triggering a section mismatch warning.
881881
*/
882882
static struct platform_driver einj_driver __refdata = {
883-
.remove_new = __exit_p(einj_remove),
883+
.remove = __exit_p(einj_remove),
884884
.driver = {
885885
.name = "acpi-einj",
886886
},

drivers/acpi/apei/ghes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ static struct platform_driver ghes_platform_driver = {
16051605
.name = "GHES",
16061606
},
16071607
.probe = ghes_probe,
1608-
.remove_new = ghes_remove,
1608+
.remove = ghes_remove,
16091609
};
16101610

16111611
void __init acpi_ghes_init(void)

drivers/acpi/arm64/agdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static struct platform_driver agdi_driver = {
8888
.name = "agdi",
8989
},
9090
.probe = agdi_probe,
91-
.remove_new = agdi_remove,
91+
.remove = agdi_remove,
9292
};
9393

9494
void __init acpi_agdi_init(void)

drivers/acpi/battery.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,15 +1218,21 @@ static int acpi_battery_add(struct acpi_device *device)
12181218
if (device->dep_unmet)
12191219
return -EPROBE_DEFER;
12201220

1221-
battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
1221+
battery = devm_kzalloc(&device->dev, sizeof(*battery), GFP_KERNEL);
12221222
if (!battery)
12231223
return -ENOMEM;
12241224
battery->device = device;
12251225
strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
12261226
strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
12271227
device->driver_data = battery;
1228-
mutex_init(&battery->lock);
1229-
mutex_init(&battery->sysfs_lock);
1228+
result = devm_mutex_init(&device->dev, &battery->lock);
1229+
if (result)
1230+
return result;
1231+
1232+
result = devm_mutex_init(&device->dev, &battery->sysfs_lock);
1233+
if (result)
1234+
return result;
1235+
12301236
if (acpi_has_method(battery->device->handle, "_BIX"))
12311237
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
12321238

@@ -1238,7 +1244,9 @@ static int acpi_battery_add(struct acpi_device *device)
12381244
device->status.battery_present ? "present" : "absent");
12391245

12401246
battery->pm_nb.notifier_call = battery_notify;
1241-
register_pm_notifier(&battery->pm_nb);
1247+
result = register_pm_notifier(&battery->pm_nb);
1248+
if (result)
1249+
goto fail;
12421250

12431251
device_init_wakeup(&device->dev, 1);
12441252

@@ -1254,9 +1262,6 @@ static int acpi_battery_add(struct acpi_device *device)
12541262
unregister_pm_notifier(&battery->pm_nb);
12551263
fail:
12561264
sysfs_remove_battery(battery);
1257-
mutex_destroy(&battery->lock);
1258-
mutex_destroy(&battery->sysfs_lock);
1259-
kfree(battery);
12601265

12611266
return result;
12621267
}
@@ -1276,13 +1281,8 @@ static void acpi_battery_remove(struct acpi_device *device)
12761281
device_init_wakeup(&device->dev, 0);
12771282
unregister_pm_notifier(&battery->pm_nb);
12781283
sysfs_remove_battery(battery);
1279-
1280-
mutex_destroy(&battery->lock);
1281-
mutex_destroy(&battery->sysfs_lock);
1282-
kfree(battery);
12831284
}
12841285

1285-
#ifdef CONFIG_PM_SLEEP
12861286
/* this is needed to learn about changes made in suspended state */
12871287
static int acpi_battery_resume(struct device *dev)
12881288
{
@@ -1299,11 +1299,8 @@ static int acpi_battery_resume(struct device *dev)
12991299
acpi_battery_update(battery, true);
13001300
return 0;
13011301
}
1302-
#else
1303-
#define acpi_battery_resume NULL
1304-
#endif
13051302

1306-
static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
1303+
static DEFINE_SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
13071304

13081305
static struct acpi_driver acpi_battery_driver = {
13091306
.name = "battery",
@@ -1313,7 +1310,7 @@ static struct acpi_driver acpi_battery_driver = {
13131310
.add = acpi_battery_add,
13141311
.remove = acpi_battery_remove,
13151312
},
1316-
.drv.pm = &acpi_battery_pm,
1313+
.drv.pm = pm_sleep_ptr(&acpi_battery_pm),
13171314
.drv.probe_type = PROBE_PREFER_ASYNCHRONOUS,
13181315
};
13191316

0 commit comments

Comments
 (0)