Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
...

+190 -102
+10 -1
drivers/acpi/Kconfig
··· 132 132 makes it possible to force the kernel to return "5" as the supported 133 133 ACPI revision via the "acpi_rev_override" command line switch. 134 134 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 + 135 143 config ACPI_EC_DEBUGFS 136 144 tristate "EC read/write access through /sys/kernel/debug/ec" 145 + depends on ACPI_EC 137 146 help 138 147 Say N to disable Embedded Controller /sys/kernel/debug interface 139 148 ··· 442 433 443 434 config ACPI_SBS 444 435 tristate "Smart Battery System" 445 - depends on X86 436 + depends on X86 && ACPI_EC 446 437 select POWER_SUPPLY 447 438 help 448 439 This driver supports the Smart Battery System, another
+1 -1
drivers/acpi/Makefile
··· 41 41 acpi-y += acpi_processor.o 42 42 acpi-y += processor_core.o 43 43 acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o 44 - acpi-y += ec.o 44 + acpi-$(CONFIG_ACPI_EC) += ec.o 45 45 acpi-$(CONFIG_ACPI_DOCK) += dock.o 46 46 acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o 47 47 obj-$(CONFIG_ACPI_MCFG) += pci_mcfg.o
+1 -1
drivers/acpi/ac.c
··· 290 290 291 291 static struct platform_driver acpi_ac_driver = { 292 292 .probe = acpi_ac_probe, 293 - .remove_new = acpi_ac_remove, 293 + .remove = acpi_ac_remove, 294 294 .driver = { 295 295 .name = "ac", 296 296 .acpi_match_table = ac_device_ids,
+1 -1
drivers/acpi/acpi_apd.c
··· 86 86 if (!clk_data->name) 87 87 return -ENOMEM; 88 88 89 - strcpy(clk_data->name, obj->string.pointer); 89 + strscpy(clk_data->name, obj->string.pointer, obj->string.length); 90 90 } else { 91 91 /* Set default name to mclk if entry missing in firmware */ 92 92 clk_data->name = "mclk";
+1 -1
drivers/acpi/acpi_pad.c
··· 462 462 463 463 static struct platform_driver acpi_pad_driver = { 464 464 .probe = acpi_pad_probe, 465 - .remove_new = acpi_pad_remove, 465 + .remove = acpi_pad_remove, 466 466 .driver = { 467 467 .dev_groups = acpi_pad_groups, 468 468 .name = "processor_aggregator",
+1 -1
drivers/acpi/acpi_tad.c
··· 684 684 .acpi_match_table = acpi_tad_ids, 685 685 }, 686 686 .probe = acpi_tad_probe, 687 - .remove_new = acpi_tad_remove, 687 + .remove = acpi_tad_remove, 688 688 }; 689 689 MODULE_DEVICE_TABLE(acpi, acpi_tad_ids); 690 690
+1 -1
drivers/acpi/apei/einj-core.c
··· 880 880 * triggering a section mismatch warning. 881 881 */ 882 882 static struct platform_driver einj_driver __refdata = { 883 - .remove_new = __exit_p(einj_remove), 883 + .remove = __exit_p(einj_remove), 884 884 .driver = { 885 885 .name = "acpi-einj", 886 886 },
+1 -1
drivers/acpi/apei/ghes.c
··· 1605 1605 .name = "GHES", 1606 1606 }, 1607 1607 .probe = ghes_probe, 1608 - .remove_new = ghes_remove, 1608 + .remove = ghes_remove, 1609 1609 }; 1610 1610 1611 1611 void __init acpi_ghes_init(void)
+1 -1
drivers/acpi/arm64/agdi.c
··· 88 88 .name = "agdi", 89 89 }, 90 90 .probe = agdi_probe, 91 - .remove_new = agdi_remove, 91 + .remove = agdi_remove, 92 92 }; 93 93 94 94 void __init acpi_agdi_init(void)
+14 -17
drivers/acpi/battery.c
··· 1218 1218 if (device->dep_unmet) 1219 1219 return -EPROBE_DEFER; 1220 1220 1221 - battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); 1221 + battery = devm_kzalloc(&device->dev, sizeof(*battery), GFP_KERNEL); 1222 1222 if (!battery) 1223 1223 return -ENOMEM; 1224 1224 battery->device = device; 1225 1225 strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 1226 1226 strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 1227 1227 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 + 1230 1236 if (acpi_has_method(battery->device->handle, "_BIX")) 1231 1237 set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); 1232 1238 ··· 1244 1238 device->status.battery_present ? "present" : "absent"); 1245 1239 1246 1240 battery->pm_nb.notifier_call = battery_notify; 1247 - register_pm_notifier(&battery->pm_nb); 1241 + result = register_pm_notifier(&battery->pm_nb); 1242 + if (result) 1243 + goto fail; 1248 1244 1249 1245 device_init_wakeup(&device->dev, 1); 1250 1246 ··· 1262 1254 unregister_pm_notifier(&battery->pm_nb); 1263 1255 fail: 1264 1256 sysfs_remove_battery(battery); 1265 - mutex_destroy(&battery->lock); 1266 - mutex_destroy(&battery->sysfs_lock); 1267 - kfree(battery); 1268 1257 1269 1258 return result; 1270 1259 } ··· 1281 1276 device_init_wakeup(&device->dev, 0); 1282 1277 unregister_pm_notifier(&battery->pm_nb); 1283 1278 sysfs_remove_battery(battery); 1284 - 1285 - mutex_destroy(&battery->lock); 1286 - mutex_destroy(&battery->sysfs_lock); 1287 - kfree(battery); 1288 1279 } 1289 1280 1290 - #ifdef CONFIG_PM_SLEEP 1291 1281 /* this is needed to learn about changes made in suspended state */ 1292 1282 static int acpi_battery_resume(struct device *dev) 1293 1283 { ··· 1299 1299 acpi_battery_update(battery, true); 1300 1300 return 0; 1301 1301 } 1302 - #else 1303 - #define acpi_battery_resume NULL 1304 - #endif 1305 1302 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); 1307 1304 1308 1305 static struct acpi_driver acpi_battery_driver = { 1309 1306 .name = "battery", ··· 1310 1313 .add = acpi_battery_add, 1311 1314 .remove = acpi_battery_remove, 1312 1315 }, 1313 - .drv.pm = &acpi_battery_pm, 1316 + .drv.pm = pm_sleep_ptr(&acpi_battery_pm), 1314 1317 .drv.probe_type = PROBE_PREFER_ASYNCHRONOUS, 1315 1318 }; 1316 1319
+4 -3
drivers/acpi/cppc_acpi.c
··· 1011 1011 *val = 0; 1012 1012 size = GET_BIT_WIDTH(reg); 1013 1013 1014 - if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 1014 + if (IS_ENABLED(CONFIG_HAS_IOPORT) && 1015 + reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 1015 1016 u32 val_u32; 1016 1017 acpi_status status; 1017 1018 ··· 1086 1085 1087 1086 size = GET_BIT_WIDTH(reg); 1088 1087 1089 - if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 1088 + if (IS_ENABLED(CONFIG_HAS_IOPORT) && 1089 + reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 1090 1090 acpi_status status; 1091 1091 1092 1092 status = acpi_os_write_port((acpi_io_address)reg->address, ··· 1142 1140 return -EFAULT; 1143 1141 } 1144 1142 val = MASK_VAL_WRITE(reg, prev_val, val); 1145 - val |= prev_val; 1146 1143 } 1147 1144 1148 1145 switch (size) {
+1 -1
drivers/acpi/dptf/dptf_pch_fivr.c
··· 158 158 159 159 static struct platform_driver pch_fivr_driver = { 160 160 .probe = pch_fivr_add, 161 - .remove_new = pch_fivr_remove, 161 + .remove = pch_fivr_remove, 162 162 .driver = { 163 163 .name = "dptf_pch_fivr", 164 164 .acpi_match_table = pch_fivr_device_ids,
+1 -1
drivers/acpi/dptf/dptf_power.c
··· 242 242 243 243 static struct platform_driver dptf_power_driver = { 244 244 .probe = dptf_power_add, 245 - .remove_new = dptf_power_remove, 245 + .remove = dptf_power_remove, 246 246 .driver = { 247 247 .name = "dptf_power", 248 248 .acpi_match_table = int3407_device_ids,
+2 -2
drivers/acpi/ec.c
··· 1677 1677 struct acpi_ec *ec; 1678 1678 int ret; 1679 1679 1680 - strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1681 - strcpy(acpi_device_class(device), ACPI_EC_CLASS); 1680 + strscpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1681 + strscpy(acpi_device_class(device), ACPI_EC_CLASS); 1682 1682 1683 1683 if (boot_ec && (boot_ec->handle == device->handle || 1684 1684 !strcmp(acpi_device_hid(device), ACPI_ECDT_HID))) {
+2 -2
drivers/acpi/event.c
··· 28 28 { 29 29 struct acpi_bus_event event; 30 30 31 - strcpy(event.device_class, dev->pnp.device_class); 32 - strcpy(event.bus_id, dev->pnp.bus_id); 31 + strscpy(event.device_class, dev->pnp.device_class); 32 + strscpy(event.bus_id, dev->pnp.bus_id); 33 33 event.type = type; 34 34 event.data = data; 35 35 return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
+1 -1
drivers/acpi/evged.c
··· 185 185 186 186 static struct platform_driver ged_driver = { 187 187 .probe = ged_probe, 188 - .remove_new = ged_remove, 188 + .remove = ged_remove, 189 189 .shutdown = ged_shutdown, 190 190 .driver = { 191 191 .name = MODULE_NAME,
+1 -1
drivers/acpi/fan_core.c
··· 448 448 449 449 static struct platform_driver acpi_fan_driver = { 450 450 .probe = acpi_fan_probe, 451 - .remove_new = acpi_fan_remove, 451 + .remove = acpi_fan_remove, 452 452 .driver = { 453 453 .name = "acpi-fan", 454 454 .acpi_match_table = fan_device_ids,
+25
drivers/acpi/internal.h
··· 215 215 /* External interfaces use first EC only, so remember */ 216 216 typedef int (*acpi_ec_query_func) (void *data); 217 217 218 + #ifdef CONFIG_ACPI_EC 219 + 218 220 void acpi_ec_init(void); 219 221 void acpi_ec_ecdt_probe(void); 220 222 void acpi_ec_dsdt_probe(void); ··· 233 231 bool acpi_ec_dispatch_gpe(void); 234 232 #endif 235 233 234 + #else 235 + 236 + static inline void acpi_ec_init(void) {} 237 + static inline void acpi_ec_ecdt_probe(void) {} 238 + static inline void acpi_ec_dsdt_probe(void) {} 239 + static inline void acpi_ec_block_transactions(void) {} 240 + static inline void acpi_ec_unblock_transactions(void) {} 241 + static inline int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, 242 + acpi_handle handle, acpi_ec_query_func func, 243 + void *data) 244 + { 245 + return -ENXIO; 246 + } 247 + static inline void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) {} 248 + static inline void acpi_ec_register_opregions(struct acpi_device *adev) {} 249 + 250 + static inline void acpi_ec_flush_work(void) {} 251 + static inline bool acpi_ec_dispatch_gpe(void) 252 + { 253 + return false; 254 + } 255 + 256 + #endif 236 257 237 258 /*-------------------------------------------------------------------------- 238 259 Suspend/Resume
+12
drivers/acpi/osl.c
··· 642 642 { 643 643 u32 dummy; 644 644 645 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) { 646 + /* 647 + * set all-1 result as if reading from non-existing 648 + * I/O port 649 + */ 650 + *value = GENMASK(width, 0); 651 + return AE_NOT_IMPLEMENTED; 652 + } 653 + 645 654 if (value) 646 655 *value = 0; 647 656 else ··· 674 665 675 666 acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) 676 667 { 668 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 669 + return AE_NOT_IMPLEMENTED; 670 + 677 671 if (width <= 8) { 678 672 outb(value, port); 679 673 } else if (width <= 16) {
+2 -2
drivers/acpi/pci_link.c
··· 714 714 return -ENOMEM; 715 715 716 716 link->device = device; 717 - strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); 718 - strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); 717 + strscpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); 718 + strscpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); 719 719 device->driver_data = link; 720 720 721 721 mutex_lock(&acpi_link_lock);
+2 -2
drivers/acpi/pci_root.c
··· 689 689 690 690 root->device = device; 691 691 root->segment = segment & 0xFFFF; 692 - strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); 693 - strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 692 + strscpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); 693 + strscpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 694 694 device->driver_data = root; 695 695 696 696 if (hotadd && dmar_device_add(handle)) {
+1 -4
drivers/acpi/pfr_telemetry.c
··· 272 272 273 273 case PFRT_LOG_IOC_GET_INFO: 274 274 info.log_level = get_pfrt_log_level(pfrt_log_dev); 275 - if (ret < 0) 276 - return ret; 277 - 278 275 info.log_type = pfrt_log_dev->info.log_type; 279 276 info.log_revid = pfrt_log_dev->info.log_revid; 280 277 if (copy_to_user(p, &info, sizeof(info))) ··· 422 425 .acpi_match_table = acpi_pfrt_log_ids, 423 426 }, 424 427 .probe = acpi_pfrt_log_probe, 425 - .remove_new = acpi_pfrt_log_remove, 428 + .remove = acpi_pfrt_log_remove, 426 429 }; 427 430 module_platform_driver(acpi_pfrt_log_driver); 428 431
+1 -1
drivers/acpi/pfr_update.c
··· 565 565 .acpi_match_table = acpi_pfru_ids, 566 566 }, 567 567 .probe = acpi_pfru_probe, 568 - .remove_new = acpi_pfru_remove, 568 + .remove = acpi_pfru_remove, 569 569 }; 570 570 module_platform_driver(acpi_pfru_driver); 571 571
+2 -2
drivers/acpi/power.c
··· 950 950 mutex_init(&resource->resource_lock); 951 951 INIT_LIST_HEAD(&resource->list_node); 952 952 INIT_LIST_HEAD(&resource->dependents); 953 - strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 954 - strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 953 + strscpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 954 + strscpy(acpi_device_class(device), ACPI_POWER_CLASS); 955 955 device->power.state = ACPI_STATE_UNKNOWN; 956 956 device->flags.match_driver = true; 957 957
+5 -8
drivers/acpi/processor_perflib.c
··· 24 24 25 25 #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" 26 26 27 - static DEFINE_MUTEX(performance_mutex); 28 - 29 27 /* 30 28 * _PPC support is implemented as a CPUfreq policy notifier: 31 29 * This means each time a CPUfreq driver registered also with ··· 207 209 } 208 210 } 209 211 212 + #ifdef CONFIG_X86 213 + 214 + static DEFINE_MUTEX(performance_mutex); 215 + 210 216 static int acpi_processor_get_performance_control(struct acpi_processor *pr) 211 217 { 212 218 int result = 0; ··· 269 267 return result; 270 268 } 271 269 272 - #ifdef CONFIG_X86 273 270 /* 274 271 * Some AMDs have 50MHz frequency multiples, but only provide 100MHz rounding 275 272 * in their ACPI data. Calculate the real values and fix up the _PSS data. ··· 299 298 px->core_frequency = (100 * (fid + 8)) >> did; 300 299 } 301 300 } 302 - #else 303 - static void amd_fixup_frequency(struct acpi_processor_px *px, int i) {}; 304 - #endif 305 301 306 302 static int acpi_processor_get_performance_states(struct acpi_processor *pr) 307 303 { ··· 438 440 * the BIOS is older than the CPU and does not know its frequencies 439 441 */ 440 442 update_bios: 441 - #ifdef CONFIG_X86 442 443 if (acpi_has_method(pr->handle, "_PPC")) { 443 444 if(boot_cpu_has(X86_FEATURE_EST)) 444 445 pr_warn(FW_BUG "BIOS needs update for CPU " 445 446 "frequency support\n"); 446 447 } 447 - #endif 448 448 return result; 449 449 } 450 450 EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info); ··· 784 788 mutex_unlock(&performance_mutex); 785 789 } 786 790 EXPORT_SYMBOL(acpi_processor_unregister_performance); 791 + #endif
+2 -2
drivers/acpi/sbs.c
··· 644 644 645 645 sbs->hc = acpi_driver_data(acpi_dev_parent(device)); 646 646 sbs->device = device; 647 - strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); 648 - strcpy(acpi_device_class(device), ACPI_SBS_CLASS); 647 + strscpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); 648 + strscpy(acpi_device_class(device), ACPI_SBS_CLASS); 649 649 device->driver_data = sbs; 650 650 651 651 result = acpi_charger_add(sbs);
+3 -10
drivers/acpi/sbshc.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/interrupt.h> 16 16 #include "sbshc.h" 17 + #include "internal.h" 17 18 18 19 #define ACPI_SMB_HC_CLASS "smbus_host_ctl" 19 20 #define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC" ··· 237 236 return 0; 238 237 } 239 238 240 - typedef int (*acpi_ec_query_func) (void *data); 241 - 242 - extern int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, 243 - acpi_handle handle, acpi_ec_query_func func, 244 - void *data); 245 - 246 239 static int acpi_smbus_hc_add(struct acpi_device *device) 247 240 { 248 241 int status; ··· 252 257 return -EIO; 253 258 } 254 259 255 - strcpy(acpi_device_name(device), ACPI_SMB_HC_DEVICE_NAME); 256 - strcpy(acpi_device_class(device), ACPI_SMB_HC_CLASS); 260 + strscpy(acpi_device_name(device), ACPI_SMB_HC_DEVICE_NAME); 261 + strscpy(acpi_device_class(device), ACPI_SMB_HC_CLASS); 257 262 258 263 hc = kzalloc(sizeof(struct acpi_smb_hc), GFP_KERNEL); 259 264 if (!hc) ··· 272 277 273 278 return 0; 274 279 } 275 - 276 - extern void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); 277 280 278 281 static void acpi_smbus_hc_remove(struct acpi_device *device) 279 282 {
+7 -7
drivers/acpi/scan.c
··· 1179 1179 * TBD: Shouldn't this value be unique (within the ACPI namespace)? 1180 1180 */ 1181 1181 if (!acpi_dev_parent(device)) { 1182 - strcpy(device->pnp.bus_id, "ACPI"); 1182 + strscpy(device->pnp.bus_id, "ACPI"); 1183 1183 return; 1184 1184 } 1185 1185 1186 1186 switch (device->device_type) { 1187 1187 case ACPI_BUS_TYPE_POWER_BUTTON: 1188 - strcpy(device->pnp.bus_id, "PWRF"); 1188 + strscpy(device->pnp.bus_id, "PWRF"); 1189 1189 break; 1190 1190 case ACPI_BUS_TYPE_SLEEP_BUTTON: 1191 - strcpy(device->pnp.bus_id, "SLPF"); 1191 + strscpy(device->pnp.bus_id, "SLPF"); 1192 1192 break; 1193 1193 case ACPI_BUS_TYPE_ECDT_EC: 1194 - strcpy(device->pnp.bus_id, "ECDT"); 1194 + strscpy(device->pnp.bus_id, "ECDT"); 1195 1195 break; 1196 1196 default: 1197 1197 acpi_get_name(device->handle, ACPI_SINGLE_NAME, &buffer); ··· 1202 1202 else 1203 1203 break; 1204 1204 } 1205 - strcpy(device->pnp.bus_id, bus_id); 1205 + strscpy(device->pnp.bus_id, bus_id); 1206 1206 break; 1207 1207 } 1208 1208 } ··· 1453 1453 acpi_object_is_system_bus(handle)) { 1454 1454 /* \_SB, \_TZ, LNXSYBUS */ 1455 1455 acpi_add_id(pnp, ACPI_BUS_HID); 1456 - strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); 1457 - strcpy(pnp->device_class, ACPI_BUS_CLASS); 1456 + strscpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); 1457 + strscpy(pnp->device_class, ACPI_BUS_CLASS); 1458 1458 } 1459 1459 1460 1460 break;
+3 -3
drivers/acpi/thermal.c
··· 796 796 return -ENOMEM; 797 797 798 798 tz->device = device; 799 - strcpy(tz->name, device->pnp.bus_id); 800 - strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 801 - strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); 799 + strscpy(tz->name, device->pnp.bus_id); 800 + strscpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 801 + strscpy(acpi_device_class(device), ACPI_THERMAL_CLASS); 802 802 device->driver_data = tz; 803 803 804 804 acpi_thermal_aml_dependency_fix(tz);
+16
drivers/acpi/video_detect.c
··· 551 551 }, 552 552 { 553 553 .callback = video_detect_force_native, 554 + /* Apple MacBook Air 7,2 */ 555 + .matches = { 556 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 557 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir7,2"), 558 + }, 559 + }, 560 + { 561 + .callback = video_detect_force_native, 554 562 /* Apple MacBook Air 9,1 */ 555 563 .matches = { 556 564 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ··· 571 563 .matches = { 572 564 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 573 565 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro9,2"), 566 + }, 567 + }, 568 + { 569 + .callback = video_detect_force_native, 570 + /* Apple MacBook Pro 11,2 */ 571 + .matches = { 572 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 573 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro11,2"), 574 574 }, 575 575 }, 576 576 {
+41 -10
drivers/acpi/x86/utils.c
··· 12 12 13 13 #include <linux/acpi.h> 14 14 #include <linux/dmi.h> 15 + #include <linux/pci.h> 15 16 #include <linux/platform_device.h> 16 17 #include <asm/cpu_device_id.h> 17 18 #include <asm/intel-family.h> ··· 393 392 ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY), 394 393 }, 395 394 { 395 + /* Vexia Edu Atla 10 tablet 9V version */ 396 + .matches = { 397 + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 398 + DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), 399 + /* Above strings are too generic, also match on BIOS date */ 400 + DMI_MATCH(DMI_BIOS_DATE, "08/25/2014"), 401 + }, 402 + .driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS | 403 + ACPI_QUIRK_UART1_SKIP | 404 + ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY | 405 + ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS), 406 + }, 407 + { 396 408 /* Whitelabel (sold as various brands) TM800A550L */ 397 409 .matches = { 398 410 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), ··· 453 439 struct acpi_device *adev = ACPI_COMPANION(controller_parent); 454 440 const struct dmi_system_id *dmi_id; 455 441 long quirks = 0; 456 - u64 uid; 457 - int ret; 458 - 459 - ret = acpi_dev_uid_to_integer(adev, &uid); 460 - if (ret) 461 - return 0; 442 + u64 uid = 0; 462 443 463 444 dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids); 464 - if (dmi_id) 465 - quirks = (unsigned long)dmi_id->driver_data; 445 + if (!dmi_id) 446 + return 0; 466 447 467 - if (!dev_is_platform(controller_parent)) { 448 + quirks = (unsigned long)dmi_id->driver_data; 449 + 450 + /* uid is left at 0 on errors and 0 is not a valid UART UID */ 451 + acpi_dev_uid_to_integer(adev, &uid); 452 + 453 + /* For PCI UARTs without an UID */ 454 + if (!uid && dev_is_pci(controller_parent)) { 455 + struct pci_dev *pdev = to_pci_dev(controller_parent); 456 + 457 + /* 458 + * Devfn values for PCI UARTs on Bay Trail SoCs, which are 459 + * the only devices where this fallback is necessary. 460 + */ 461 + if (pdev->devfn == PCI_DEVFN(0x1e, 3)) 462 + uid = 1; 463 + else if (pdev->devfn == PCI_DEVFN(0x1e, 4)) 464 + uid = 2; 465 + } 466 + 467 + if (!uid) 468 + return 0; 469 + 470 + if (!dev_is_platform(controller_parent) && !dev_is_pci(controller_parent)) { 468 471 /* PNP enumerated UARTs */ 469 472 if ((quirks & ACPI_QUIRK_PNP_UART1_SKIP) && uid == 1) 470 473 *skip = true; ··· 536 505 * Set skip to true so that the tty core creates a serdev ctrl device. 537 506 * The backlight driver will manually create the serdev client device. 538 507 */ 539 - if (acpi_dev_hid_match(adev, "DELL0501")) { 508 + if (adev && acpi_dev_hid_match(adev, "DELL0501")) { 540 509 *skip = true; 541 510 /* 542 511 * Create a platform dev for dell-uart-backlight to bind to.
+1
drivers/char/Kconfig
··· 238 238 config SONYPI 239 239 tristate "Sony Vaio Programmable I/O Control Device support" 240 240 depends on X86_32 && PCI && INPUT 241 + depends on ACPI_EC || !ACPI 241 242 help 242 243 This driver enables access to the Sony Programmable I/O Control 243 244 Device which can be found in many (all ?) Sony Vaio laptops.
+2 -1
drivers/hwmon/Kconfig
··· 1752 1752 1753 1753 config SENSORS_OXP 1754 1754 tristate "OneXPlayer EC fan control" 1755 - depends on ACPI 1755 + depends on ACPI_EC 1756 1756 depends on X86 1757 1757 help 1758 1758 If you say yes here you get support for fan readings and control over ··· 2592 2592 config SENSORS_ASUS_EC 2593 2593 tristate "ASUS EC Sensors" 2594 2594 depends on X86 2595 + depends on ACPI_EC 2595 2596 help 2596 2597 If you say yes here you get support for the ACPI embedded controller 2597 2598 hardware monitoring interface found in ASUS motherboards. The driver
+12 -10
drivers/platform/x86/Kconfig
··· 52 52 config HUAWEI_WMI 53 53 tristate "Huawei WMI laptop extras driver" 54 54 depends on ACPI_BATTERY 55 + depends on ACPI_EC 55 56 depends on ACPI_WMI 56 57 depends on INPUT 57 58 select INPUT_SPARSEKMAP ··· 148 147 149 148 config ACERHDF 150 149 tristate "Acer Aspire One temperature and fan driver" 151 - depends on ACPI && THERMAL 150 + depends on ACPI_EC && THERMAL 152 151 select THERMAL_GOV_BANG_BANG 153 152 help 154 153 This is a driver for Acer Aspire One netbooks. It allows to access ··· 187 186 depends on SERIO_I8042 188 187 depends on INPUT 189 188 depends on RFKILL || RFKILL = n 189 + depends on ACPI_EC 190 190 depends on ACPI_WMI 191 191 depends on ACPI_VIDEO || ACPI_VIDEO = n 192 192 depends on HWMON ··· 336 334 337 335 config EEEPC_LAPTOP 338 336 tristate "Eee PC Hotkey Driver" 339 - depends on ACPI 337 + depends on ACPI_EC 340 338 depends on INPUT 341 339 depends on RFKILL || RFKILL = n 342 340 depends on ACPI_VIDEO || ACPI_VIDEO = n ··· 505 503 506 504 config THINKPAD_ACPI 507 505 tristate "ThinkPad ACPI Laptop Extras" 508 - depends on ACPI 506 + depends on ACPI_EC 509 507 depends on ACPI_BATTERY 510 508 depends on INPUT 511 509 depends on RFKILL || RFKILL = n ··· 684 682 685 683 config MSI_EC 686 684 tristate "MSI EC Extras" 687 - depends on ACPI 685 + depends on ACPI_EC 688 686 depends on ACPI_BATTERY 689 687 help 690 688 This driver allows various MSI laptops' functionalities to be ··· 692 690 693 691 config MSI_LAPTOP 694 692 tristate "MSI Laptop Extras" 695 - depends on ACPI 693 + depends on ACPI_EC 696 694 depends on BACKLIGHT_CLASS_DEVICE 697 695 depends on ACPI_VIDEO || ACPI_VIDEO = n 698 696 depends on RFKILL ··· 798 796 799 797 config SAMSUNG_Q10 800 798 tristate "Samsung Q10 Extras" 801 - depends on ACPI 799 + depends on ACPI_EC 802 800 select BACKLIGHT_CLASS_DEVICE 803 801 help 804 802 This driver provides support for backlight control on Samsung Q10 ··· 806 804 807 805 config ACPI_TOSHIBA 808 806 tristate "Toshiba Laptop Extras" 809 - depends on ACPI 807 + depends on ACPI_EC 810 808 depends on ACPI_BATTERY 811 809 depends on ACPI_WMI 812 810 select LEDS_CLASS ··· 906 904 907 905 config COMPAL_LAPTOP 908 906 tristate "Compal (and others) Laptop Extras" 909 - depends on ACPI 907 + depends on ACPI_EC 910 908 depends on BACKLIGHT_CLASS_DEVICE 911 909 depends on ACPI_VIDEO || ACPI_VIDEO = n 912 910 depends on RFKILL ··· 951 949 952 950 config SONY_LAPTOP 953 951 tristate "Sony Laptop Extras" 954 - depends on ACPI 952 + depends on ACPI_EC 955 953 depends on ACPI_VIDEO || ACPI_VIDEO = n 956 954 depends on BACKLIGHT_CLASS_DEVICE 957 955 depends on INPUT ··· 974 972 975 973 config SYSTEM76_ACPI 976 974 tristate "System76 ACPI Driver" 977 - depends on ACPI 975 + depends on ACPI_EC 978 976 depends on ACPI_BATTERY 979 977 depends on HWMON 980 978 depends on INPUT
+1
drivers/platform/x86/dell/Kconfig
··· 194 194 config DELL_WMI_PRIVACY 195 195 bool "Dell WMI Hardware Privacy Support" 196 196 depends on DELL_WMI 197 + depends on ACPI_EC 197 198 help 198 199 This option adds integration with the "Dell Hardware Privacy" 199 200 feature of Dell laptops to the dell-wmi driver.
+1
drivers/platform/x86/hp/Kconfig
··· 37 37 config HP_WMI 38 38 tristate "HP WMI extras" 39 39 default m 40 + depends on ACPI_EC 40 41 depends on ACPI_WMI 41 42 depends on INPUT 42 43 depends on RFKILL || RFKILL = n
+1 -1
drivers/platform/x86/intel/Kconfig
··· 62 62 63 63 config INTEL_OAKTRAIL 64 64 tristate "Intel Oaktrail Platform Extras" 65 - depends on ACPI 65 + depends on ACPI_EC 66 66 depends on ACPI_VIDEO || ACPI_VIDEO=n 67 67 depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI 68 68 help
+6 -2
include/linux/acpi.h
··· 1164 1164 int acpi_subsys_suspend(struct device *dev); 1165 1165 int acpi_subsys_freeze(struct device *dev); 1166 1166 int acpi_subsys_poweroff(struct device *dev); 1167 - void acpi_ec_mark_gpe_for_wake(void); 1168 - void acpi_ec_set_gpe_wake_mask(u8 action); 1169 1167 int acpi_subsys_restore_early(struct device *dev); 1170 1168 #else 1171 1169 static inline int acpi_subsys_prepare(struct device *dev) { return 0; } ··· 1174 1176 static inline int acpi_subsys_freeze(struct device *dev) { return 0; } 1175 1177 static inline int acpi_subsys_poweroff(struct device *dev) { return 0; } 1176 1178 static inline int acpi_subsys_restore_early(struct device *dev) { return 0; } 1179 + #endif 1180 + 1181 + #if defined(CONFIG_ACPI_EC) && defined(CONFIG_PM_SLEEP) 1182 + void acpi_ec_mark_gpe_for_wake(void); 1183 + void acpi_ec_set_gpe_wake_mask(u8 action); 1184 + #else 1177 1185 static inline void acpi_ec_mark_gpe_for_wake(void) {} 1178 1186 static inline void acpi_ec_set_gpe_wake_mask(u8 action) {} 1179 1187 #endif