* [PATCH] platform/x86: dell-smbios-base: Support systems without tokens
@ 2018-06-15 17:12 Mario Limonciello
2018-06-22 23:54 ` Darren Hart
0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2018-06-15 17:12 UTC (permalink / raw)
To: dvhart, Andy Shevchenko; +Cc: LKML, platform-driver-x86, Mario Limonciello
Some Dell servers can use dell-smbios but they don't support the
token interface. Make it optional.
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
drivers/platform/x86/dell-smbios-base.c | 35 ++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c
index 446dbff..ac88032 100644
--- a/drivers/platform/x86/dell-smbios-base.c
+++ b/drivers/platform/x86/dell-smbios-base.c
@@ -212,6 +212,12 @@ int dell_smbios_call_filter(struct device *d,
if ((buffer->cmd_class == CLASS_TOKEN_READ ||
buffer->cmd_class == CLASS_TOKEN_WRITE) &&
buffer->cmd_select < 3) {
+ /* tokens enabled ? */
+ if (!da_tokens) {
+ dev_dbg(d, "no token support on this system\n");
+ return -EINVAL;
+ }
+
/* find the matching token ID */
for (i = 0; i < da_num_tokens; i++) {
if (da_tokens[i].location != buffer->input[0])
@@ -315,6 +321,9 @@ struct calling_interface_token *dell_smbios_find_token(int tokenid)
{
int i;
+ if (!da_tokens)
+ return NULL;
+
for (i = 0; i < da_num_tokens; i++) {
if (da_tokens[i].tokenID == tokenid)
return &da_tokens[i];
@@ -570,11 +579,6 @@ static int __init dell_smbios_init(void)
dmi_walk(find_tokens, NULL);
- if (!da_tokens) {
- pr_info("Unable to find dmi tokens\n");
- return -ENODEV;
- }
-
ret = platform_driver_register(&platform_driver);
if (ret)
goto fail_platform_driver;
@@ -588,13 +592,6 @@ static int __init dell_smbios_init(void)
if (ret)
goto fail_platform_device_add;
- /* duplicate tokens will cause problems building sysfs files */
- zero_duplicates(&platform_device->dev);
-
- ret = build_tokens_sysfs(platform_device);
- if (ret)
- goto fail_create_group;
-
/* register backends */
wmi = init_dell_smbios_wmi();
if (wmi)
@@ -605,7 +602,16 @@ static int __init dell_smbios_init(void)
if (wmi && smm) {
pr_err("No SMBIOS backends available (wmi: %d, smm: %d)\n",
wmi, smm);
- goto fail_sysfs;
+ goto fail_create_group;
+ }
+
+ if (da_tokens) {
+ /* duplicate tokens will cause problems building sysfs files */
+ zero_duplicates(&platform_device->dev);
+
+ ret = build_tokens_sysfs(platform_device);
+ if (ret)
+ goto fail_sysfs;
}
return 0;
@@ -633,7 +639,8 @@ static void __exit dell_smbios_exit(void)
exit_dell_smbios_smm();
mutex_lock(&smbios_mutex);
if (platform_device) {
- free_group(platform_device);
+ if (da_tokens)
+ free_group(platform_device);
platform_device_unregister(platform_device);
platform_driver_unregister(&platform_driver);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: dell-smbios-base: Support systems without tokens
2018-06-15 17:12 [PATCH] platform/x86: dell-smbios-base: Support systems without tokens Mario Limonciello
@ 2018-06-22 23:54 ` Darren Hart
0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2018-06-22 23:54 UTC (permalink / raw)
To: Mario Limonciello; +Cc: Andy Shevchenko, LKML, platform-driver-x86
On Fri, Jun 15, 2018 at 12:12:51PM -0500, Mario Limonciello wrote:
> Some Dell servers can use dell-smbios but they don't support the
> token interface. Make it optional.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Thanks Mario, queued.
--
Darren Hart
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-22 23:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15 17:12 [PATCH] platform/x86: dell-smbios-base: Support systems without tokens Mario Limonciello
2018-06-22 23:54 ` Darren Hart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox