mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: ideapad-laptop: use dev_groups to register attribute groups
@ 2025-02-10 15:53 Ovidiu Panait
  2025-02-13 13:46 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Ovidiu Panait @ 2025-02-10 15:53 UTC (permalink / raw)
  To: ike.pan, hdegoede, ilpo.jarvinen
  Cc: platform-driver-x86, linux-kernel, Ovidiu Panait

Instead of manually adding/removing attribute groups, set
(struct device_driver).dev_groups pointer to have the driver
core do it.

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
---
 drivers/platform/x86/ideapad-laptop.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 30bd366d7b58..17a09b7784ed 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -854,6 +854,7 @@ static const struct attribute_group ideapad_attribute_group = {
 	.is_visible = ideapad_is_visible,
 	.attrs = ideapad_attributes
 };
+__ATTRIBUTE_GROUPS(ideapad_attribute);
 
 /*
  * DYTC Platform profile
@@ -1244,21 +1245,6 @@ static void ideapad_unregister_rfkill(struct ideapad_private *priv, int dev)
 	rfkill_destroy(priv->rfk[dev]);
 }
 
-/*
- * Platform device
- */
-static int ideapad_sysfs_init(struct ideapad_private *priv)
-{
-	return device_add_group(&priv->platform_device->dev,
-				&ideapad_attribute_group);
-}
-
-static void ideapad_sysfs_exit(struct ideapad_private *priv)
-{
-	device_remove_group(&priv->platform_device->dev,
-			    &ideapad_attribute_group);
-}
-
 /*
  * input device
  */
@@ -2175,10 +2161,6 @@ static int ideapad_acpi_add(struct platform_device *pdev)
 
 	ideapad_check_features(priv);
 
-	err = ideapad_sysfs_init(priv);
-	if (err)
-		return err;
-
 	ideapad_debugfs_init(priv);
 
 	err = ideapad_input_init(priv);
@@ -2265,7 +2247,6 @@ static int ideapad_acpi_add(struct platform_device *pdev)
 
 input_failed:
 	ideapad_debugfs_exit(priv);
-	ideapad_sysfs_exit(priv);
 
 	return err;
 }
@@ -2293,7 +2274,6 @@ static void ideapad_acpi_remove(struct platform_device *pdev)
 	ideapad_kbd_bl_exit(priv);
 	ideapad_input_exit(priv);
 	ideapad_debugfs_exit(priv);
-	ideapad_sysfs_exit(priv);
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -2325,6 +2305,7 @@ static struct platform_driver ideapad_acpi_driver = {
 		.name   = "ideapad_acpi",
 		.pm     = &ideapad_pm,
 		.acpi_match_table = ACPI_PTR(ideapad_device_ids),
+		.dev_groups = ideapad_attribute_groups,
 	},
 };
 
-- 
2.47.1


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

* Re: [PATCH] platform/x86: ideapad-laptop: use dev_groups to register attribute groups
  2025-02-10 15:53 [PATCH] platform/x86: ideapad-laptop: use dev_groups to register attribute groups Ovidiu Panait
@ 2025-02-13 13:46 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-02-13 13:46 UTC (permalink / raw)
  To: ike.pan, hdegoede, Ovidiu Panait; +Cc: platform-driver-x86, linux-kernel

On Mon, 10 Feb 2025 17:53:33 +0200, Ovidiu Panait wrote:

> Instead of manually adding/removing attribute groups, set
> (struct device_driver).dev_groups pointer to have the driver
> core do it.
> 
> 


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

The list of commits applied:
[1/1] platform/x86: ideapad-laptop: use dev_groups to register attribute groups
      commit: d497c47481f8e8f13e3191c9a707ed942d3bb3d7

--
 i.


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

end of thread, other threads:[~2025-02-13 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-10 15:53 [PATCH] platform/x86: ideapad-laptop: use dev_groups to register attribute groups Ovidiu Panait
2025-02-13 13:46 ` 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

all inboxes | Powered by JetHome®