LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM strings too
@ 2018-04-17 19:45 Mario Limonciello
  2018-04-19 23:43 ` Darren Hart
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2018-04-17 19:45 UTC (permalink / raw)
  To: dvhart, Andy Shevchenko; +Cc: LKML, platform-driver-x86, Mario Limonciello

Sergey reported that some much older Dell systems don't support
the OEM string "Dell System" but instead supported www.dell.com
in OEM strings.

Match both of these to indicate that this driver is running on
a Dell system.

Reported-by: Sergey Kubushyn <ksi@koi8.net>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Sergey Kubushyn <ksi@koi8.net>
---
 drivers/platform/x86/dell-smbios-base.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c
index 2485c80..fbd6557 100644
--- a/drivers/platform/x86/dell-smbios-base.c
+++ b/drivers/platform/x86/dell-smbios-base.c
@@ -555,11 +555,15 @@ static void free_group(struct platform_device *pdev)
 
 static int __init dell_smbios_init(void)
 {
-	const struct dmi_device *valid;
+	const struct dmi_device *valid_dell_system;
+	const struct dmi_device *valid_www;
 	int ret, wmi, smm;
 
-	valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL);
-	if (!valid) {
+	valid_dell_system =
+		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL);
+	valid_www =
+		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL);
+	if (!valid_dell_system && !valid_www) {
 		pr_err("Unable to run on non-Dell system\n");
 		return -ENODEV;
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM strings too
  2018-04-17 19:45 [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM strings too Mario Limonciello
@ 2018-04-19 23:43 ` Darren Hart
  2018-04-20 14:39   ` Mario.Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: Darren Hart @ 2018-04-19 23:43 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: Andy Shevchenko, LKML, platform-driver-x86

On Tue, Apr 17, 2018 at 02:45:56PM -0500, Mario Limonciello wrote:
> Sergey reported that some much older Dell systems don't support
> the OEM string "Dell System" but instead supported www.dell.com
> in OEM strings.
> 
> Match both of these to indicate that this driver is running on
> a Dell system.
> 
> Reported-by: Sergey Kubushyn <ksi@koi8.net>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> Tested-by: Sergey Kubushyn <ksi@koi8.net>
> ---
>  drivers/platform/x86/dell-smbios-base.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c
> index 2485c80..fbd6557 100644
> --- a/drivers/platform/x86/dell-smbios-base.c
> +++ b/drivers/platform/x86/dell-smbios-base.c
> @@ -555,11 +555,15 @@ static void free_group(struct platform_device *pdev)
>  
>  static int __init dell_smbios_init(void)
>  {
> -	const struct dmi_device *valid;
> +	const struct dmi_device *valid_dell_system;
> +	const struct dmi_device *valid_www;
>  	int ret, wmi, smm;
>  
> -	valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL);
> -	if (!valid) {
> +	valid_dell_system =
> +		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL);
> +	valid_www =
> +		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL);
> +	if (!valid_dell_system && !valid_www) {
>  		pr_err("Unable to run on non-Dell system\n");
>  		return -ENODEV;
>  	}

Hrm, rather than introduce another variable that we don't use and always perform
both tests, when most of the time we only need to do the first, how about
something like:


>From 2cb5959dadec769167350a9bcb1d212a02b17af8 Mon Sep 17 00:00:00 2001
Message-Id: <2cb5959dadec769167350a9bcb1d212a02b17af8.1524181265.git.dvhart@infradead.org>
From: Mario Limonciello <mario.limonciello@dell.com>
Date: Tue, 17 Apr 2018 14:45:56 -0500
Subject: [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM
 strings too

Sergey reported that some much older Dell systems don't support
the OEM string "Dell System" but instead supported www.dell.com
in OEM strings.

Match both of these to indicate that this driver is running on
a Dell system.

Reported-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Sergey Kubushyn <ksi@koi8.net>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
[dvhart: Simplify DMI logic and eliminate unnecessary variables]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
---
 drivers/platform/x86/dell-smbios-base.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c
index 33fb2a20458a..9dc282ed5a9e 100644
--- a/drivers/platform/x86/dell-smbios-base.c
+++ b/drivers/platform/x86/dell-smbios-base.c
@@ -555,11 +555,10 @@ static void free_group(struct platform_device *pdev)
 
 static int __init dell_smbios_init(void)
 {
-	const struct dmi_device *valid;
 	int ret, wmi, smm;
 
-	valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL);
-	if (!valid) {
+	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) &&
+	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) {
 		pr_err("Unable to run on non-Dell system\n");
 		return -ENODEV;
 	}
-- 
2.14.3


-- 
Darren Hart
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM strings too
  2018-04-19 23:43 ` Darren Hart
@ 2018-04-20 14:39   ` Mario.Limonciello
  0 siblings, 0 replies; 3+ messages in thread
From: Mario.Limonciello @ 2018-04-20 14:39 UTC (permalink / raw)
  To: dvhart; +Cc: andy.shevchenko, linux-kernel, platform-driver-x86



> -----Original Message-----
> From: Darren Hart [mailto:dvhart@infradead.org]
> Sent: Thursday, April 19, 2018 6:43 PM
> To: Limonciello, Mario
> Cc: Andy Shevchenko; LKML; platform-driver-x86@vger.kernel.org
> Subject: Re: [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM
> strings too
> 
> On Tue, Apr 17, 2018 at 02:45:56PM -0500, Mario Limonciello wrote:
> > Sergey reported that some much older Dell systems don't support
> > the OEM string "Dell System" but instead supported www.dell.com
> > in OEM strings.
> >
> > Match both of these to indicate that this driver is running on
> > a Dell system.
> >
> > Reported-by: Sergey Kubushyn <ksi@koi8.net>
> > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> > Tested-by: Sergey Kubushyn <ksi@koi8.net>
> > ---
> >  drivers/platform/x86/dell-smbios-base.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-
> smbios-base.c
> > index 2485c80..fbd6557 100644
> > --- a/drivers/platform/x86/dell-smbios-base.c
> > +++ b/drivers/platform/x86/dell-smbios-base.c
> > @@ -555,11 +555,15 @@ static void free_group(struct platform_device *pdev)
> >
> >  static int __init dell_smbios_init(void)
> >  {
> > -	const struct dmi_device *valid;
> > +	const struct dmi_device *valid_dell_system;
> > +	const struct dmi_device *valid_www;
> >  	int ret, wmi, smm;
> >
> > -	valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System",
> NULL);
> > -	if (!valid) {
> > +	valid_dell_system =
> > +		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System",
> NULL);
> > +	valid_www =
> > +		dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com",
> NULL);
> > +	if (!valid_dell_system && !valid_www) {
> >  		pr_err("Unable to run on non-Dell system\n");
> >  		return -ENODEV;
> >  	}
> 
> Hrm, rather than introduce another variable that we don't use and always perform
> both tests, when most of the time we only need to do the first, how about
> something like:
> 

Darren,

That looks good to me, thanks!

> 
> From 2cb5959dadec769167350a9bcb1d212a02b17af8 Mon Sep 17 00:00:00 2001
> Message-Id:
> <2cb5959dadec769167350a9bcb1d212a02b17af8.1524181265.git.dvhart@infrad
> ead.org>
> From: Mario Limonciello <mario.limonciello@dell.com>
> Date: Tue, 17 Apr 2018 14:45:56 -0500
> Subject: [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM
>  strings too
> 
> Sergey reported that some much older Dell systems don't support
> the OEM string "Dell System" but instead supported www.dell.com
> in OEM strings.
> 
> Match both of these to indicate that this driver is running on
> a Dell system.
> 
> Reported-by: Sergey Kubushyn <ksi@koi8.net>
> Tested-by: Sergey Kubushyn <ksi@koi8.net>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> [dvhart: Simplify DMI logic and eliminate unnecessary variables]
> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
> ---
>  drivers/platform/x86/dell-smbios-base.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-
> smbios-base.c
> index 33fb2a20458a..9dc282ed5a9e 100644
> --- a/drivers/platform/x86/dell-smbios-base.c
> +++ b/drivers/platform/x86/dell-smbios-base.c
> @@ -555,11 +555,10 @@ static void free_group(struct platform_device *pdev)
> 
>  static int __init dell_smbios_init(void)
>  {
> -	const struct dmi_device *valid;
>  	int ret, wmi, smm;
> 
> -	valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System",
> NULL);
> -	if (!valid) {
> +	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL)
> &&
> +	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com",
> NULL)) {
>  		pr_err("Unable to run on non-Dell system\n");
>  		return -ENODEV;
>  	}
> --
> 2.14.3
> 
> 
> --
> Darren Hart
> VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-20 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 19:45 [PATCH] platform/x86: dell-smbios: Match on www.dell.com in OEM strings too Mario Limonciello
2018-04-19 23:43 ` Darren Hart
2018-04-20 14:39   ` Mario.Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).