forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'platform-drivers-x86-v4.16-6' of git://git.infradead.org/l…
…inux-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
- Loading branch information
Showing
6 changed files
with
82 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ static DEFINE_MUTEX(smbios_mutex); | |
struct smbios_device { | ||
struct list_head list; | ||
struct device *device; | ||
int (*call_fn)(struct calling_interface_buffer *); | ||
int (*call_fn)(struct calling_interface_buffer *arg); | ||
}; | ||
|
||
struct smbios_call { | ||
|
@@ -352,8 +352,10 @@ static void __init parse_da_table(const struct dmi_header *dm) | |
struct calling_interface_structure *table = | ||
container_of(dm, struct calling_interface_structure, header); | ||
|
||
/* 4 bytes of table header, plus 7 bytes of Dell header, plus at least | ||
6 bytes of entry */ | ||
/* | ||
* 4 bytes of table header, plus 7 bytes of Dell header | ||
* plus at least 6 bytes of entry | ||
*/ | ||
|
||
if (dm->length < 17) | ||
return; | ||
|
@@ -554,7 +556,7 @@ static void free_group(struct platform_device *pdev) | |
static int __init dell_smbios_init(void) | ||
{ | ||
const struct dmi_device *valid; | ||
int ret; | ||
int ret, wmi, smm; | ||
|
||
valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL); | ||
if (!valid) { | ||
|
@@ -589,8 +591,24 @@ static int __init dell_smbios_init(void) | |
if (ret) | ||
goto fail_create_group; | ||
|
||
/* register backends */ | ||
wmi = init_dell_smbios_wmi(); | ||
if (wmi) | ||
pr_debug("Failed to initialize WMI backend: %d\n", wmi); | ||
smm = init_dell_smbios_smm(); | ||
if (smm) | ||
pr_debug("Failed to initialize SMM backend: %d\n", smm); | ||
if (wmi && smm) { | ||
pr_err("No SMBIOS backends available (wmi: %d, smm: %d)\n", | ||
wmi, smm); | ||
goto fail_sysfs; | ||
} | ||
|
||
return 0; | ||
|
||
fail_sysfs: | ||
free_group(platform_device); | ||
|
||
fail_create_group: | ||
platform_device_del(platform_device); | ||
|
||
|
@@ -607,6 +625,8 @@ static int __init dell_smbios_init(void) | |
|
||
static void __exit dell_smbios_exit(void) | ||
{ | ||
exit_dell_smbios_wmi(); | ||
exit_dell_smbios_smm(); | ||
mutex_lock(&smbios_mutex); | ||
if (platform_device) { | ||
free_group(platform_device); | ||
|
@@ -623,5 +643,6 @@ module_exit(dell_smbios_exit); | |
MODULE_AUTHOR("Matthew Garrett <[email protected]>"); | ||
MODULE_AUTHOR("Gabriele Mazzotta <[email protected]>"); | ||
MODULE_AUTHOR("Pali Rohár <[email protected]>"); | ||
MODULE_AUTHOR("Mario Limonciello <[email protected]>"); | ||
MODULE_DESCRIPTION("Common functions for kernel modules using Dell SMBIOS"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ static const struct dmi_system_id dell_device_table[] __initconst = { | |
}; | ||
MODULE_DEVICE_TABLE(dmi, dell_device_table); | ||
|
||
static void __init parse_da_table(const struct dmi_header *dm) | ||
static void parse_da_table(const struct dmi_header *dm) | ||
{ | ||
struct calling_interface_structure *table = | ||
container_of(dm, struct calling_interface_structure, header); | ||
|
@@ -73,7 +73,7 @@ static void __init parse_da_table(const struct dmi_header *dm) | |
da_command_code = table->cmdIOCode; | ||
} | ||
|
||
static void __init find_cmd_address(const struct dmi_header *dm, void *dummy) | ||
static void find_cmd_address(const struct dmi_header *dm, void *dummy) | ||
{ | ||
switch (dm->type) { | ||
case 0xda: /* Calling interface */ | ||
|
@@ -128,7 +128,7 @@ static bool test_wsmt_enabled(void) | |
return false; | ||
} | ||
|
||
static int __init dell_smbios_smm_init(void) | ||
int init_dell_smbios_smm(void) | ||
{ | ||
int ret; | ||
/* | ||
|
@@ -176,21 +176,11 @@ static int __init dell_smbios_smm_init(void) | |
return ret; | ||
} | ||
|
||
static void __exit dell_smbios_smm_exit(void) | ||
void exit_dell_smbios_smm(void) | ||
{ | ||
if (platform_device) { | ||
dell_smbios_unregister_device(&platform_device->dev); | ||
platform_device_unregister(platform_device); | ||
free_page((unsigned long)buffer); | ||
} | ||
} | ||
|
||
subsys_initcall(dell_smbios_smm_init); | ||
module_exit(dell_smbios_smm_exit); | ||
|
||
MODULE_AUTHOR("Matthew Garrett <[email protected]>"); | ||
MODULE_AUTHOR("Gabriele Mazzotta <[email protected]>"); | ||
MODULE_AUTHOR("Pali Rohár <[email protected]>"); | ||
MODULE_AUTHOR("Mario Limonciello <[email protected]>"); | ||
MODULE_DESCRIPTION("Dell SMBIOS communications over SMI"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,7 +228,7 @@ static const struct wmi_device_id dell_smbios_wmi_id_table[] = { | |
{ }, | ||
}; | ||
|
||
static void __init parse_b1_table(const struct dmi_header *dm) | ||
static void parse_b1_table(const struct dmi_header *dm) | ||
{ | ||
struct misc_bios_flags_structure *flags = | ||
container_of(dm, struct misc_bios_flags_structure, header); | ||
|
@@ -242,7 +242,7 @@ static void __init parse_b1_table(const struct dmi_header *dm) | |
wmi_supported = 1; | ||
} | ||
|
||
static void __init find_b1(const struct dmi_header *dm, void *dummy) | ||
static void find_b1(const struct dmi_header *dm, void *dummy) | ||
{ | ||
switch (dm->type) { | ||
case 0xb1: /* misc bios flags */ | ||
|
@@ -261,7 +261,7 @@ static struct wmi_driver dell_smbios_wmi_driver = { | |
.filter_callback = dell_smbios_wmi_filter, | ||
}; | ||
|
||
static int __init init_dell_smbios_wmi(void) | ||
int init_dell_smbios_wmi(void) | ||
{ | ||
dmi_walk(find_b1, NULL); | ||
|
||
|
@@ -271,15 +271,9 @@ static int __init init_dell_smbios_wmi(void) | |
return wmi_driver_register(&dell_smbios_wmi_driver); | ||
} | ||
|
||
static void __exit exit_dell_smbios_wmi(void) | ||
void exit_dell_smbios_wmi(void) | ||
{ | ||
wmi_driver_unregister(&dell_smbios_wmi_driver); | ||
} | ||
|
||
module_init(init_dell_smbios_wmi); | ||
module_exit(exit_dell_smbios_wmi); | ||
|
||
MODULE_ALIAS("wmi:" DELL_WMI_SMBIOS_GUID); | ||
MODULE_AUTHOR("Mario Limonciello <[email protected]>"); | ||
MODULE_DESCRIPTION("Dell SMBIOS communications over WMI"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters