Skip to content

Commit

Permalink
platform/x86: dell-wmi-sysman: Use firmware_attributes_class helper
Browse files Browse the repository at this point in the history
Update Dell WMI sysman driver to use newly implemented helper module.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Pearson <markpearson@lenovo.com>
Link: https://lore.kernel.org/r/20210530223111.25929-2-markpearson@lenovo.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Mark Pearson authored and Hans de Goede committed Jun 16, 2021
1 parent 17b707f commit 8a1c379
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions drivers/platform/x86/dell/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ config DELL_WMI_SYSMAN
depends on ACPI_WMI
depends on DMI
select NLS
select FW_ATTR_CLASS
help
This driver allows changing BIOS settings on many Dell machines from
2018 and newer without the use of any additional software.
Expand Down
18 changes: 8 additions & 10 deletions drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
#include <linux/kernel.h>
#include <linux/wmi.h>
#include "dell-wmi-sysman.h"
#include "../../firmware_attributes_class.h"

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

static struct class firmware_attributes_class = {
.name = "firmware-attributes",
};

struct wmi_sysman_priv wmi_priv = {
.mutex = __MUTEX_INITIALIZER(wmi_priv.mutex),
};

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


/**
Expand Down Expand Up @@ -542,11 +540,11 @@ static int __init sysman_init(void)
goto err_exit_bios_attr_pass_interface;
}

ret = class_register(&firmware_attributes_class);
ret = fw_attributes_class_get(&fw_attr_class);
if (ret)
goto err_exit_bios_attr_pass_interface;

wmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
wmi_priv.class_dev = device_create(fw_attr_class, NULL, MKDEV(0, 0),
NULL, "%s", DRIVER_NAME);
if (IS_ERR(wmi_priv.class_dev)) {
ret = PTR_ERR(wmi_priv.class_dev);
Expand Down Expand Up @@ -603,10 +601,10 @@ static int __init sysman_init(void)
release_attributes_data();

err_destroy_classdev:
device_destroy(&firmware_attributes_class, MKDEV(0, 0));
device_destroy(fw_attr_class, MKDEV(0, 0));

err_unregister_class:
class_unregister(&firmware_attributes_class);
fw_attributes_class_put();

err_exit_bios_attr_pass_interface:
exit_bios_attr_pass_interface();
Expand All @@ -620,8 +618,8 @@ static int __init sysman_init(void)
static void __exit sysman_exit(void)
{
release_attributes_data();
device_destroy(&firmware_attributes_class, MKDEV(0, 0));
class_unregister(&firmware_attributes_class);
device_destroy(fw_attr_class, MKDEV(0, 0));
fw_attributes_class_put();
exit_bios_attr_set_interface();
exit_bios_attr_pass_interface();
}
Expand Down

0 comments on commit 8a1c379

Please sign in to comment.