From e8edf53b198f5656d5ae99685bc6c1f616662b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 4 Mar 2016 14:09:06 +0100 Subject: [PATCH] dell-laptop: move dell_smi_error() to dell-smbios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dell_smi_error() method could be used by modules other than dell-laptop for convenient translation of SMBIOS request errors into errno values. Thus, move it to dell-smbios. Signed-off-by: Michał Kępień Reviewed-by: Pali Rohár Signed-off-by: Darren Hart --- drivers/platform/x86/dell-laptop.c | 14 -------------- drivers/platform/x86/dell-smbios.c | 16 ++++++++++++++++ drivers/platform/x86/dell-smbios.h | 2 ++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 76064c817f3d..cbafb95f694c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -273,20 +273,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = { { } }; -static inline int dell_smi_error(int value) -{ - switch (value) { - case 0: /* Completed successfully */ - return 0; - case -1: /* Completed with error */ - return -EIO; - case -2: /* Function not supported */ - return -ENXIO; - default: /* Unknown error */ - return -EINVAL; - } -} - /* * Derived from information in smbios-wireless-ctl: * diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c index 2a4992a9c538..942572f183b5 100644 --- a/drivers/platform/x86/dell-smbios.c +++ b/drivers/platform/x86/dell-smbios.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,21 @@ static int da_command_code; static int da_num_tokens; static struct calling_interface_token *da_tokens; +int dell_smi_error(int value) +{ + switch (value) { + case 0: /* Completed successfully */ + return 0; + case -1: /* Completed with error */ + return -EIO; + case -2: /* Function not supported */ + return -ENXIO; + default: /* Unknown error */ + return -EINVAL; + } +} +EXPORT_SYMBOL_GPL(dell_smi_error); + struct calling_interface_buffer *dell_smbios_get_buffer(void) { mutex_lock(&buffer_mutex); diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h index 4f69b16f7769..52febe62d189 100644 --- a/drivers/platform/x86/dell-smbios.h +++ b/drivers/platform/x86/dell-smbios.h @@ -35,6 +35,8 @@ struct calling_interface_token { }; }; +int dell_smi_error(int value); + struct calling_interface_buffer *dell_smbios_get_buffer(void); void dell_smbios_clear_buffer(void); void dell_smbios_release_buffer(void); -- GitLab