[PATCH] platform/x86: dell-sysman: add support for alienware products

Crag Wang posted 1 patch 2 months ago
.../x86/dell/dell-wmi-sysman/sysman.c         | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
[PATCH] platform/x86: dell-sysman: add support for alienware products
Posted by Crag Wang 2 months ago
Use SMBIOS Type 1 manfacturer instead OEM strings to verify product
compatibility. Also, add Alienware products to the support scope.

Signed-off-by: Crag Wang <crag_wang@dell.com>
---
 .../x86/dell/dell-wmi-sysman/sysman.c         | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index 9def7983d7d6..2f3f7e307b29 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -516,12 +516,27 @@ static int init_bios_attributes(int attr_type, const char *guid)
 	return retval;
 }
 
+static const struct dmi_system_id sysman_dev_table[] __initconst = {
+	{
+		.ident = "Dell Inc.",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+		},
+	},
+	{
+		.ident = "Alienware",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
+		},
+	},
+	{}
+};
+
 static int __init sysman_init(void)
 {
 	int ret = 0;
 
-	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) &&
-	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) {
+	if (!dmi_check_system(sysman_dev_table)) {
 		pr_err("Unable to run on non-Dell system\n");
 		return -ENODEV;
 	}
-- 
2.43.0
Re: [PATCH] platform/x86: dell-sysman: add support for alienware products
Posted by Mario Limonciello 2 months ago
On 9/23/2024 01:36, Crag Wang wrote:
> Use SMBIOS Type 1 manfacturer instead OEM strings to verify product
> compatibility. Also, add Alienware products to the support scope.

Alienware systems don't use OEM string "Dell System"?  TIL.

> 
> Signed-off-by: Crag Wang <crag_wang@dell.com>
> ---
>   .../x86/dell/dell-wmi-sysman/sysman.c         | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index 9def7983d7d6..2f3f7e307b29 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -516,12 +516,27 @@ static int init_bios_attributes(int attr_type, const char *guid)
>   	return retval;
>   }
>   
> +static const struct dmi_system_id sysman_dev_table[] __initconst = {
> +	{
> +		.ident = "Dell Inc.",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
> +		},
> +	},
> +	{
> +		.ident = "Alienware",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> +		},
> +	},
> +	{}
> +};
> +
>   static int __init sysman_init(void)
>   {
>   	int ret = 0;
>   
> -	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) &&
> -	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) {
> +	if (!dmi_check_system(sysman_dev_table)) {

Would it perhaps make sense to be an && condition instead of remove the 
dmi_find_device() conditions?

IE:

if (!dmi_find_device() && !dmi_find_device() && !dmi_check_system())

Then you can continue to cover anything that has been rebranded too.

>   		pr_err("Unable to run on non-Dell system\n");
>   		return -ENODEV;
>   	}
[PATCHv2 1/1] platform/x86: dell-sysman: add support for alienware products
Posted by Crag Wang 2 months ago
Remove the URL check and add alienware string for broader support.

Signed-off-by: Crag Wang <crag_wang@dell.com>
---
 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index 9def7983d7d6..68c63e1fbd27 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -521,7 +521,7 @@ static int __init sysman_init(void)
 	int ret = 0;
 
 	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) &&
-	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) {
+	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Alienware", NULL)) {
 		pr_err("Unable to run on non-Dell system\n");
 		return -ENODEV;
 	}
-- 
2.43.0
Re: [PATCHv2 1/1] platform/x86: dell-sysman: add support for alienware products
Posted by Mario Limonciello 2 months ago
On 9/24/2024 00:02, Crag Wang wrote:
> Remove the URL check and add alienware string for broader support.
> 
> Signed-off-by: Crag Wang <crag_wang@dell.com>
> ---
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
>   drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index 9def7983d7d6..68c63e1fbd27 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -521,7 +521,7 @@ static int __init sysman_init(void)
>   	int ret = 0;
>   
>   	if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) &&
> -	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) {
> +	    !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Alienware", NULL)) {
>   		pr_err("Unable to run on non-Dell system\n");
>   		return -ENODEV;
>   	}