Skip to content

Commit d97de65

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: dell-wmi-sysman: Use firmware_attributes_class helper
Update Dell WMI sysman driver to use newly implemented helper module. Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent 035c9f9 commit d97de65

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/platform/x86/dell/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ config DELL_WMI_SYSMAN
206206
depends on ACPI_WMI
207207
depends on DMI
208208
select NLS
209+
select FW_ATTR_CLASS
209210
help
210211
This driver allows changing BIOS settings on many Dell machines from
211212
2018 and newer without the use of any additional software.

drivers/platform/x86/dell/dell-wmi-sysman/sysman.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
#include <linux/kernel.h>
1414
#include <linux/wmi.h>
1515
#include "dell-wmi-sysman.h"
16+
#include "../../firmware_attributes_class.h"
1617

1718
#define MAX_TYPES 4
1819
#include <linux/nls.h>
1920

20-
static struct class firmware_attributes_class = {
21-
.name = "firmware-attributes",
22-
};
23-
2421
struct wmi_sysman_priv wmi_priv = {
2522
.mutex = __MUTEX_INITIALIZER(wmi_priv.mutex),
2623
};
2724

2825
/* reset bios to defaults */
2926
static const char * const reset_types[] = {"builtinsafe", "lastknowngood", "factory", "custom"};
3027
static int reset_option = -1;
28+
struct class *fw_attr_class;
3129

3230

3331
/**
@@ -542,11 +540,11 @@ static int __init sysman_init(void)
542540
goto err_exit_bios_attr_pass_interface;
543541
}
544542

545-
ret = class_register(&firmware_attributes_class);
543+
ret = fw_attributes_class_get(&fw_attr_class);
546544
if (ret)
547545
goto err_exit_bios_attr_pass_interface;
548546

549-
wmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
547+
wmi_priv.class_dev = device_create(fw_attr_class, NULL, MKDEV(0, 0),
550548
NULL, "%s", DRIVER_NAME);
551549
if (IS_ERR(wmi_priv.class_dev)) {
552550
ret = PTR_ERR(wmi_priv.class_dev);
@@ -603,10 +601,10 @@ static int __init sysman_init(void)
603601
release_attributes_data();
604602

605603
err_destroy_classdev:
606-
device_destroy(&firmware_attributes_class, MKDEV(0, 0));
604+
device_destroy(fw_attr_class, MKDEV(0, 0));
607605

608606
err_unregister_class:
609-
class_unregister(&firmware_attributes_class);
607+
fw_attributes_class_put();
610608

611609
err_exit_bios_attr_pass_interface:
612610
exit_bios_attr_pass_interface();
@@ -620,8 +618,8 @@ static int __init sysman_init(void)
620618
static void __exit sysman_exit(void)
621619
{
622620
release_attributes_data();
623-
device_destroy(&firmware_attributes_class, MKDEV(0, 0));
624-
class_unregister(&firmware_attributes_class);
621+
device_destroy(fw_attr_class, MKDEV(0, 0));
622+
fw_attributes_class_put();
625623
exit_bios_attr_set_interface();
626624
exit_bios_attr_pass_interface();
627625
}

0 commit comments

Comments
 (0)