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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'platform-drivers-x86-v4.16-6' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver fixes from Darren Hart:
"Correct a module loading race condition between the DELL_SMBIOS
backend modules and the first user by converting them to bool features
of the DELL_SMBIOS driver. Fixup the resulting Kconfig dependency
issue with DCDBAS"

* tag 'platform-drivers-x86-v4.16-6' of git://git.infradead.org/linux-platform-drivers-x86:
platform/x86: dell-smbios: Resolve dependency error on DCDBAS
platform/x86: Allow for SMBIOS backend defaults
platform/x86: dell-smbios: Link all dell-smbios-* modules together
platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-base
platform/x86: dell-smbios: Correct some style warnings

+82 -38
+20 -7
drivers/platform/x86/Kconfig
··· 105 105 106 106 If you have an ACPI-compatible ASUS laptop, say Y or M here. 107 107 108 + # 109 + # If the DELL_SMBIOS_SMM feature is enabled, the DELL_SMBIOS driver 110 + # becomes dependent on the DCDBAS driver. The "depends" line prevents a 111 + # configuration where DELL_SMBIOS=y while DCDBAS=m. 112 + # 108 113 config DELL_SMBIOS 109 - tristate 114 + tristate "Dell SMBIOS driver" 115 + depends on DCDBAS || DCDBAS=n 116 + ---help--- 117 + This provides support for the Dell SMBIOS calling interface. 118 + If you have a Dell computer you should enable this option. 119 + 120 + Be sure to select at least one backend for it to work properly. 110 121 111 122 config DELL_SMBIOS_WMI 112 - tristate "Dell SMBIOS calling interface (WMI implementation)" 123 + bool "Dell SMBIOS driver WMI backend" 124 + default y 113 125 depends on ACPI_WMI 114 126 select DELL_WMI_DESCRIPTOR 115 - select DELL_SMBIOS 127 + depends on DELL_SMBIOS 116 128 ---help--- 117 129 This provides an implementation for the Dell SMBIOS calling interface 118 130 communicated over ACPI-WMI. 119 131 120 - If you have a Dell computer from >2007 you should say Y or M here. 132 + If you have a Dell computer from >2007 you should say Y here. 121 133 If you aren't sure and this module doesn't work for your computer 122 134 it just won't load. 123 135 124 136 config DELL_SMBIOS_SMM 125 - tristate "Dell SMBIOS calling interface (SMM implementation)" 137 + bool "Dell SMBIOS driver SMM backend" 138 + default y 126 139 depends on DCDBAS 127 - select DELL_SMBIOS 140 + depends on DELL_SMBIOS 128 141 ---help--- 129 142 This provides an implementation for the Dell SMBIOS calling interface 130 143 communicated over SMI/SMM. 131 144 132 - If you have a Dell computer from <=2017 you should say Y or M here. 145 + If you have a Dell computer from <=2017 you should say Y here. 133 146 If you aren't sure and this module doesn't work for your computer 134 147 it just won't load. 135 148
+3 -2
drivers/platform/x86/Makefile
··· 13 13 obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o 14 14 obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o 15 15 obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o 16 - obj-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o 17 - obj-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o 16 + dell-smbios-objs := dell-smbios-base.o 17 + dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o 18 + dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o 18 19 obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o 19 20 obj-$(CONFIG_DELL_WMI) += dell-wmi.o 20 21 obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o
+4 -14
drivers/platform/x86/dell-smbios-smm.c
··· 58 58 }; 59 59 MODULE_DEVICE_TABLE(dmi, dell_device_table); 60 60 61 - static void __init parse_da_table(const struct dmi_header *dm) 61 + static void parse_da_table(const struct dmi_header *dm) 62 62 { 63 63 struct calling_interface_structure *table = 64 64 container_of(dm, struct calling_interface_structure, header); ··· 73 73 da_command_code = table->cmdIOCode; 74 74 } 75 75 76 - static void __init find_cmd_address(const struct dmi_header *dm, void *dummy) 76 + static void find_cmd_address(const struct dmi_header *dm, void *dummy) 77 77 { 78 78 switch (dm->type) { 79 79 case 0xda: /* Calling interface */ ··· 128 128 return false; 129 129 } 130 130 131 - static int __init dell_smbios_smm_init(void) 131 + int init_dell_smbios_smm(void) 132 132 { 133 133 int ret; 134 134 /* ··· 176 176 return ret; 177 177 } 178 178 179 - static void __exit dell_smbios_smm_exit(void) 179 + void exit_dell_smbios_smm(void) 180 180 { 181 181 if (platform_device) { 182 182 dell_smbios_unregister_device(&platform_device->dev); ··· 184 184 free_page((unsigned long)buffer); 185 185 } 186 186 } 187 - 188 - subsys_initcall(dell_smbios_smm_init); 189 - module_exit(dell_smbios_smm_exit); 190 - 191 - MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 192 - MODULE_AUTHOR("Gabriele Mazzotta <gabriele.mzt@gmail.com>"); 193 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 194 - MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>"); 195 - MODULE_DESCRIPTION("Dell SMBIOS communications over SMI"); 196 - MODULE_LICENSE("GPL");
+4 -10
drivers/platform/x86/dell-smbios-wmi.c
··· 228 228 { }, 229 229 }; 230 230 231 - static void __init parse_b1_table(const struct dmi_header *dm) 231 + static void parse_b1_table(const struct dmi_header *dm) 232 232 { 233 233 struct misc_bios_flags_structure *flags = 234 234 container_of(dm, struct misc_bios_flags_structure, header); ··· 242 242 wmi_supported = 1; 243 243 } 244 244 245 - static void __init find_b1(const struct dmi_header *dm, void *dummy) 245 + static void find_b1(const struct dmi_header *dm, void *dummy) 246 246 { 247 247 switch (dm->type) { 248 248 case 0xb1: /* misc bios flags */ ··· 261 261 .filter_callback = dell_smbios_wmi_filter, 262 262 }; 263 263 264 - static int __init init_dell_smbios_wmi(void) 264 + int init_dell_smbios_wmi(void) 265 265 { 266 266 dmi_walk(find_b1, NULL); 267 267 ··· 271 271 return wmi_driver_register(&dell_smbios_wmi_driver); 272 272 } 273 273 274 - static void __exit exit_dell_smbios_wmi(void) 274 + void exit_dell_smbios_wmi(void) 275 275 { 276 276 wmi_driver_unregister(&dell_smbios_wmi_driver); 277 277 } 278 278 279 - module_init(init_dell_smbios_wmi); 280 - module_exit(exit_dell_smbios_wmi); 281 - 282 279 MODULE_ALIAS("wmi:" DELL_WMI_SMBIOS_GUID); 283 - MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>"); 284 - MODULE_DESCRIPTION("Dell SMBIOS communications over WMI"); 285 - MODULE_LICENSE("GPL");
+25 -4
drivers/platform/x86/dell-smbios.c drivers/platform/x86/dell-smbios-base.c
··· 36 36 struct smbios_device { 37 37 struct list_head list; 38 38 struct device *device; 39 - int (*call_fn)(struct calling_interface_buffer *); 39 + int (*call_fn)(struct calling_interface_buffer *arg); 40 40 }; 41 41 42 42 struct smbios_call { ··· 352 352 struct calling_interface_structure *table = 353 353 container_of(dm, struct calling_interface_structure, header); 354 354 355 - /* 4 bytes of table header, plus 7 bytes of Dell header, plus at least 356 - 6 bytes of entry */ 355 + /* 356 + * 4 bytes of table header, plus 7 bytes of Dell header 357 + * plus at least 6 bytes of entry 358 + */ 357 359 358 360 if (dm->length < 17) 359 361 return; ··· 556 554 static int __init dell_smbios_init(void) 557 555 { 558 556 const struct dmi_device *valid; 559 - int ret; 557 + int ret, wmi, smm; 560 558 561 559 valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL); 562 560 if (!valid) { ··· 591 589 if (ret) 592 590 goto fail_create_group; 593 591 592 + /* register backends */ 593 + wmi = init_dell_smbios_wmi(); 594 + if (wmi) 595 + pr_debug("Failed to initialize WMI backend: %d\n", wmi); 596 + smm = init_dell_smbios_smm(); 597 + if (smm) 598 + pr_debug("Failed to initialize SMM backend: %d\n", smm); 599 + if (wmi && smm) { 600 + pr_err("No SMBIOS backends available (wmi: %d, smm: %d)\n", 601 + wmi, smm); 602 + goto fail_sysfs; 603 + } 604 + 594 605 return 0; 606 + 607 + fail_sysfs: 608 + free_group(platform_device); 595 609 596 610 fail_create_group: 597 611 platform_device_del(platform_device); ··· 625 607 626 608 static void __exit dell_smbios_exit(void) 627 609 { 610 + exit_dell_smbios_wmi(); 611 + exit_dell_smbios_smm(); 628 612 mutex_lock(&smbios_mutex); 629 613 if (platform_device) { 630 614 free_group(platform_device); ··· 643 623 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 644 624 MODULE_AUTHOR("Gabriele Mazzotta <gabriele.mzt@gmail.com>"); 645 625 MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 626 + MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>"); 646 627 MODULE_DESCRIPTION("Common functions for kernel modules using Dell SMBIOS"); 647 628 MODULE_LICENSE("GPL");
+26 -1
drivers/platform/x86/dell-smbios.h
··· 75 75 int dell_laptop_unregister_notifier(struct notifier_block *nb); 76 76 void dell_laptop_call_notifier(unsigned long action, void *data); 77 77 78 - #endif 78 + /* for the supported backends */ 79 + #ifdef CONFIG_DELL_SMBIOS_WMI 80 + int init_dell_smbios_wmi(void); 81 + void exit_dell_smbios_wmi(void); 82 + #else /* CONFIG_DELL_SMBIOS_WMI */ 83 + static inline int init_dell_smbios_wmi(void) 84 + { 85 + return -ENODEV; 86 + } 87 + static inline void exit_dell_smbios_wmi(void) 88 + {} 89 + #endif /* CONFIG_DELL_SMBIOS_WMI */ 90 + 91 + #ifdef CONFIG_DELL_SMBIOS_SMM 92 + int init_dell_smbios_smm(void); 93 + void exit_dell_smbios_smm(void); 94 + #else /* CONFIG_DELL_SMBIOS_SMM */ 95 + static inline int init_dell_smbios_smm(void) 96 + { 97 + return -ENODEV; 98 + } 99 + static inline void exit_dell_smbios_smm(void) 100 + {} 101 + #endif /* CONFIG_DELL_SMBIOS_SMM */ 102 + 103 + #endif /* _DELL_SMBIOS_H_ */