All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86/intel/wmi: thunderbolt: use dev_groups callback
@ 2022-09-27 13:56 Shyam Sundar S K
  2022-09-27 14:13 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Shyam Sundar S K @ 2022-09-27 13:56 UTC (permalink / raw)
  To: hdegoede, markgross, mario.limonciello
  Cc: platform-driver-x86, Dell.Client.Kernel, Shyam Sundar S K

use .dev_groups callback instead of manual sysfs registration.
Remove .probe and .remove callbacks as they become dummy after
using .dev_groups.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/platform/x86/intel/wmi/thunderbolt.c | 24 ++------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/platform/x86/intel/wmi/thunderbolt.c b/drivers/platform/x86/intel/wmi/thunderbolt.c
index 4ae87060d18b..fc333ff82d1e 100644
--- a/drivers/platform/x86/intel/wmi/thunderbolt.c
+++ b/drivers/platform/x86/intel/wmi/thunderbolt.c
@@ -51,26 +51,7 @@ static struct attribute *tbt_attrs[] = {
 	&dev_attr_force_power.attr,
 	NULL
 };
-
-static const struct attribute_group tbt_attribute_group = {
-	.attrs = tbt_attrs,
-};
-
-static int intel_wmi_thunderbolt_probe(struct wmi_device *wdev,
-				       const void *context)
-{
-	int ret;
-
-	ret = sysfs_create_group(&wdev->dev.kobj, &tbt_attribute_group);
-	kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE);
-	return ret;
-}
-
-static void intel_wmi_thunderbolt_remove(struct wmi_device *wdev)
-{
-	sysfs_remove_group(&wdev->dev.kobj, &tbt_attribute_group);
-	kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE);
-}
+ATTRIBUTE_GROUPS(tbt);
 
 static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
 	{ .guid_string = INTEL_WMI_THUNDERBOLT_GUID },
@@ -80,9 +61,8 @@ static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
 static struct wmi_driver intel_wmi_thunderbolt_driver = {
 	.driver = {
 		.name = "intel-wmi-thunderbolt",
+		.dev_groups = tbt_groups,
 	},
-	.probe = intel_wmi_thunderbolt_probe,
-	.remove = intel_wmi_thunderbolt_remove,
 	.id_table = intel_wmi_thunderbolt_id_table,
 };
 
-- 
2.25.1


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

* Re: [PATCH] platform/x86/intel/wmi: thunderbolt: use dev_groups callback
  2022-09-27 13:56 [PATCH] platform/x86/intel/wmi: thunderbolt: use dev_groups callback Shyam Sundar S K
@ 2022-09-27 14:13 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-09-27 14:13 UTC (permalink / raw)
  To: Shyam Sundar S K, markgross, mario.limonciello
  Cc: platform-driver-x86, Dell.Client.Kernel

Hi,

On 9/27/22 15:56, Shyam Sundar S K wrote:
> use .dev_groups callback instead of manual sysfs registration.
> Remove .probe and .remove callbacks as they become dummy after
> using .dev_groups.
> 
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/intel/wmi/thunderbolt.c | 24 ++------------------
>  1 file changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/wmi/thunderbolt.c b/drivers/platform/x86/intel/wmi/thunderbolt.c
> index 4ae87060d18b..fc333ff82d1e 100644
> --- a/drivers/platform/x86/intel/wmi/thunderbolt.c
> +++ b/drivers/platform/x86/intel/wmi/thunderbolt.c
> @@ -51,26 +51,7 @@ static struct attribute *tbt_attrs[] = {
>  	&dev_attr_force_power.attr,
>  	NULL
>  };
> -
> -static const struct attribute_group tbt_attribute_group = {
> -	.attrs = tbt_attrs,
> -};
> -
> -static int intel_wmi_thunderbolt_probe(struct wmi_device *wdev,
> -				       const void *context)
> -{
> -	int ret;
> -
> -	ret = sysfs_create_group(&wdev->dev.kobj, &tbt_attribute_group);
> -	kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE);
> -	return ret;
> -}
> -
> -static void intel_wmi_thunderbolt_remove(struct wmi_device *wdev)
> -{
> -	sysfs_remove_group(&wdev->dev.kobj, &tbt_attribute_group);
> -	kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE);
> -}
> +ATTRIBUTE_GROUPS(tbt);
>  
>  static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
>  	{ .guid_string = INTEL_WMI_THUNDERBOLT_GUID },
> @@ -80,9 +61,8 @@ static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
>  static struct wmi_driver intel_wmi_thunderbolt_driver = {
>  	.driver = {
>  		.name = "intel-wmi-thunderbolt",
> +		.dev_groups = tbt_groups,
>  	},
> -	.probe = intel_wmi_thunderbolt_probe,
> -	.remove = intel_wmi_thunderbolt_remove,
>  	.id_table = intel_wmi_thunderbolt_id_table,
>  };
>  


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

end of thread, other threads:[~2022-09-27 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 13:56 [PATCH] platform/x86/intel/wmi: thunderbolt: use dev_groups callback Shyam Sundar S K
2022-09-27 14:13 ` Hans de Goede

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.