linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration
@ 2025-06-26  1:17 Kurt Borja
  2025-06-26  1:17 ` [PATCH 1/3] platform/x86: hp-bioscfg: Fix class " Kurt Borja
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kurt Borja @ 2025-06-26  1:17 UTC (permalink / raw)
  To: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
	Thomas Weißschuh, Mark Pearson, Prasanth Ksr,
	Mario Limonciello, Divya Bharathi
  Cc: platform-driver-x86, linux-kernel, Dell.Client.Kernel, Kurt Borja

Hi all,

Using device_destroy() for unregistering firmware_attributes_class
devices may cause issues if there is more than one device under this
class. See details in the commit message.

This patchset fixes this problem for all users.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
Kurt Borja (3):
      platform/x86: hp-bioscfg: Fix class device unregistration
      platform/x86: think-lmi: Fix class device unregistration
      platform/x86: dell-wmi-sysman: Fix class device unregistration

 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 4 ++--
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c       | 4 ++--
 drivers/platform/x86/lenovo/think-lmi.c            | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 73f0f2b52c5ea67b3140b23f58d8079d158839c8
change-id: 20250625-dest-fix-b9de524340b2
-- 
 ~ Kurt


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

* [PATCH 1/3] platform/x86: hp-bioscfg: Fix class device unregistration
  2025-06-26  1:17 [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration Kurt Borja
@ 2025-06-26  1:17 ` Kurt Borja
  2025-06-26  1:17 ` [PATCH 2/3] platform/x86: think-lmi: " Kurt Borja
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kurt Borja @ 2025-06-26  1:17 UTC (permalink / raw)
  To: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
	Thomas Weißschuh, Mark Pearson, Prasanth Ksr,
	Mario Limonciello, Divya Bharathi
  Cc: platform-driver-x86, linux-kernel, Dell.Client.Kernel, Kurt Borja

Devices under the firmware_attributes_class do not have unique a dev_t.
Therefore, device_unregister() should be used instead of
device_destroy(), since the latter may match any device with a given
dev_t.

Fixes: a34fc329b189 ("platform/x86: hp-bioscfg: bioscfg")
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index 13237890fc92002e7e730b1c235ddf068a6737cd..5bfa7159f5bcd57385a20fe9ac646597b320a378 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
@@ -1034,7 +1034,7 @@ static int __init hp_init(void)
 	release_attributes_data();
 
 err_destroy_classdev:
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(bioscfg_drv.class_dev);
 
 err_unregister_class:
 	hp_exit_attr_set_interface();
@@ -1045,7 +1045,7 @@ static int __init hp_init(void)
 static void __exit hp_exit(void)
 {
 	release_attributes_data();
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(bioscfg_drv.class_dev);
 
 	hp_exit_attr_set_interface();
 }

-- 
2.50.0


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

* [PATCH 2/3] platform/x86: think-lmi: Fix class device unregistration
  2025-06-26  1:17 [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration Kurt Borja
  2025-06-26  1:17 ` [PATCH 1/3] platform/x86: hp-bioscfg: Fix class " Kurt Borja
@ 2025-06-26  1:17 ` Kurt Borja
  2025-06-26  1:17 ` [PATCH 3/3] platform/x86: dell-wmi-sysman: " Kurt Borja
  2025-06-30  9:19 ` [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class " Ilpo Järvinen
  3 siblings, 0 replies; 5+ messages in thread
From: Kurt Borja @ 2025-06-26  1:17 UTC (permalink / raw)
  To: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
	Thomas Weißschuh, Mark Pearson, Prasanth Ksr,
	Mario Limonciello, Divya Bharathi
  Cc: platform-driver-x86, linux-kernel, Dell.Client.Kernel, Kurt Borja

Devices under the firmware_attributes_class do not have unique a dev_t.
Therefore, device_unregister() should be used instead of
device_destroy(), since the latter may match any device with a given
dev_t.

Fixes: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 drivers/platform/x86/lenovo/think-lmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c
index 34a47269e3d34d2eda6b71af73892656cd2bf67d..085d6fb8ff6a61009217dc2a397f73116bceeb61 100644
--- a/drivers/platform/x86/lenovo/think-lmi.c
+++ b/drivers/platform/x86/lenovo/think-lmi.c
@@ -1556,7 +1556,7 @@ static int tlmi_sysfs_init(void)
 fail_create_attr:
 	tlmi_release_attr();
 fail_device_created:
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(tlmi_priv.class_dev);
 fail_class_created:
 	return ret;
 }
@@ -1783,7 +1783,7 @@ static int tlmi_analyze(struct wmi_device *wdev)
 static void tlmi_remove(struct wmi_device *wdev)
 {
 	tlmi_release_attr();
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(tlmi_priv.class_dev);
 }
 
 static int tlmi_probe(struct wmi_device *wdev, const void *context)

-- 
2.50.0


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

* [PATCH 3/3] platform/x86: dell-wmi-sysman: Fix class device unregistration
  2025-06-26  1:17 [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration Kurt Borja
  2025-06-26  1:17 ` [PATCH 1/3] platform/x86: hp-bioscfg: Fix class " Kurt Borja
  2025-06-26  1:17 ` [PATCH 2/3] platform/x86: think-lmi: " Kurt Borja
@ 2025-06-26  1:17 ` Kurt Borja
  2025-06-30  9:19 ` [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class " Ilpo Järvinen
  3 siblings, 0 replies; 5+ messages in thread
From: Kurt Borja @ 2025-06-26  1:17 UTC (permalink / raw)
  To: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
	Thomas Weißschuh, Mark Pearson, Prasanth Ksr,
	Mario Limonciello, Divya Bharathi
  Cc: platform-driver-x86, linux-kernel, Dell.Client.Kernel, Kurt Borja

Devices under the firmware_attributes_class do not have unique a dev_t.
Therefore, device_unregister() should be used instead of
device_destroy(), since the latter may match any device with a given
dev_t.

Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 4 ++--
 1 file changed, 2 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 d00389b860e4ea0655c740c78bc3751f323b6370..e345c62fbb35529fb4903f8c11f0fd07d941f94d 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -597,7 +597,7 @@ static int __init sysman_init(void)
 	release_attributes_data();
 
 err_destroy_classdev:
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(wmi_priv.class_dev);
 
 err_exit_bios_attr_pass_interface:
 	exit_bios_attr_pass_interface();
@@ -611,7 +611,7 @@ static int __init sysman_init(void)
 static void __exit sysman_exit(void)
 {
 	release_attributes_data();
-	device_destroy(&firmware_attributes_class, MKDEV(0, 0));
+	device_unregister(wmi_priv.class_dev);
 	exit_bios_attr_set_interface();
 	exit_bios_attr_pass_interface();
 }

-- 
2.50.0


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

* Re: [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration
  2025-06-26  1:17 [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration Kurt Borja
                   ` (2 preceding siblings ...)
  2025-06-26  1:17 ` [PATCH 3/3] platform/x86: dell-wmi-sysman: " Kurt Borja
@ 2025-06-30  9:19 ` Ilpo Järvinen
  3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2025-06-30  9:19 UTC (permalink / raw)
  To: Jorge Lopez, Thomas Weißschuh, Mark Pearson, Prasanth Ksr,
	Mario Limonciello, Divya Bharathi, Hans de Goede, Kurt Borja
  Cc: platform-driver-x86, linux-kernel, Dell.Client.Kernel

On Wed, 25 Jun 2025 22:17:34 -0300, Kurt Borja wrote:

> Using device_destroy() for unregistering firmware_attributes_class
> devices may cause issues if there is more than one device under this
> class. See details in the commit message.
> 
> This patchset fixes this problem for all users.
> 
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/3] platform/x86: hp-bioscfg: Fix class device unregistration
      commit: 11cba4793b95df3bc192149a6eb044f69aa0b99e
[2/3] platform/x86: think-lmi: Fix class device unregistration
      commit: 5ff1fbb3059730700b4823f43999fc1315984632
[3/3] platform/x86: dell-wmi-sysman: Fix class device unregistration
      commit: 314e5ad4782d08858b3abc325c0487bd2abc23a1

--
 i.


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

end of thread, other threads:[~2025-06-30  9:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-26  1:17 [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class device unregistration Kurt Borja
2025-06-26  1:17 ` [PATCH 1/3] platform/x86: hp-bioscfg: Fix class " Kurt Borja
2025-06-26  1:17 ` [PATCH 2/3] platform/x86: think-lmi: " Kurt Borja
2025-06-26  1:17 ` [PATCH 3/3] platform/x86: dell-wmi-sysman: " Kurt Borja
2025-06-30  9:19 ` [PATCH 0/3] platform/x86: Fix fiwmare_attributes_class " Ilpo Järvinen

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).