All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Pearson <markpearson@lenovo.com>
To: <markpearson@lenovo.com>
Cc: <hdegoede@redhat.com>, <mgross@linux.intel.com>,
	<platform-driver-x86@vger.kernel.org>, <divya.bharathi@dell.com>,
	<prasanth.ksr@dell.com>, <mario.limonciello@dell.com>
Subject: [PATCH v2 2/3] platform/x86: dell-wmi-sysman: Use firmware_attributes_class helper
Date: Sat, 8 May 2021 21:57:07 -0400	[thread overview]
Message-ID: <20210509015708.112766-2-markpearson@lenovo.com> (raw)
In-Reply-To: <20210509015708.112766-1-markpearson@lenovo.com>

Update Dell WMI sysman driver to use newly implemented helper module.

Signed-off-by: Mark Pearson <markpearson@lenovo.com>
---
Changes in v2:
 - firmare_attributes_class.c added as reqested during review of the
   proposed think_lmi.c driver. Labeling as V2 to keep series
   consistent (hope that's correct).
 - Note, compile tested only due to lack of HW to test on. Matching
   changes were made in the think-lmi.c driver and worked. Please let me
   know if any problems!

 drivers/platform/x86/dell/Kconfig              |  1 +
 .../platform/x86/dell/dell-wmi-sysman/sysman.c | 18 ++++++++----------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
index e0a55337f..931f616ff 100644
--- a/drivers/platform/x86/dell/Kconfig
+++ b/drivers/platform/x86/dell/Kconfig
@@ -197,6 +197,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.
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index c8d276d78..91ecf49ab 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -13,14 +13,11 @@
 #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),
 };
@@ -28,6 +25,7 @@ struct wmi_sysman_priv wmi_priv = {
 /* reset bios to defaults */
 static const char * const reset_types[] = {"builtinsafe", "lastknowngood", "factory", "custom"};
 static int reset_option = -1;
+struct class *fw_attr_class;
 
 
 /**
@@ -541,11 +539,11 @@ static int __init sysman_init(void)
 		goto err_exit_bios_attr_pass_interface;
 	}
 
-	ret = class_register(&firmware_attributes_class);
+	ret = fw_attributes_class_register(&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);
@@ -602,10 +600,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_remove();
 
 err_exit_bios_attr_pass_interface:
 	exit_bios_attr_pass_interface();
@@ -619,8 +617,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_remove();
 	exit_bios_attr_set_interface();
 	exit_bios_attr_pass_interface();
 }
-- 
2.31.1


  reply	other threads:[~2021-05-09  1:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09  1:57 [PATCH v2 1/3] platform/x86: firmware_attributes_class: Create helper file for handling firmware-attributes class registration events Mark Pearson
2021-05-09  1:57 ` Mark Pearson [this message]
2021-05-19 16:17   ` [PATCH v2 2/3] platform/x86: dell-wmi-sysman: Use firmware_attributes_class helper Hans de Goede
2021-05-09  1:57 ` [PATCH v2 3/3] platform/x86: think-lmi: Add WMI interface support on Lenovo platforms Mark Pearson
2021-05-19 17:06   ` Hans de Goede
2021-05-20 17:18     ` [External] " Mark Pearson
2021-05-21  8:10       ` Hans de Goede
2021-05-21  9:37         ` Hans de Goede
2021-05-21 15:55         ` Mark Pearson
2021-05-21 16:55           ` Hans de Goede
2021-05-21 19:00             ` Mark Pearson
2021-05-24 10:19             ` Ksr, Prasanth
2021-05-24 15:27               ` Hans de Goede
2021-05-25 14:02                 ` Mark Pearson
2021-05-22 11:04   ` Andy Shevchenko
2021-05-25 15:14     ` [External] " Mark Pearson
2021-05-25 16:18       ` Andy Shevchenko
2021-05-25 16:50         ` Mark Pearson
2021-05-25 16:29       ` Hans de Goede
2021-05-25 16:52         ` Mark Pearson
2021-05-19 16:15 ` [PATCH v2 1/3] platform/x86: firmware_attributes_class: Create helper file for handling firmware-attributes class registration events Hans de Goede
2021-05-19 16:45   ` [External] " Mark Pearson
2021-05-19 16:19 ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210509015708.112766-2-markpearson@lenovo.com \
    --to=markpearson@lenovo.com \
    --cc=divya.bharathi@dell.com \
    --cc=hdegoede@redhat.com \
    --cc=mario.limonciello@dell.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=prasanth.ksr@dell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.