All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-privacy: convert to use dev_groups
@ 2022-07-29 11:53 Greg Kroah-Hartman
  2022-08-02 10:52 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-29 11:53 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: Greg Kroah-Hartman, Perry Yuan, Hans de Goede, Mark Gross,
	Dell.Client.Kernel, linux-kernel

The driver core supports the ability to handle the creation and removal
of device-specific sysfs files in a race-free manner.  Take advantage of
that by converting this driver to use this by moving the sysfs
attributes into a group and assigning the dev_groups pointer to it.

Cc: Perry Yuan <Perry.Yuan@dell.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: Dell.Client.Kernel@dell.com
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/platform/x86/dell/dell-wmi-privacy.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-privacy.c b/drivers/platform/x86/dell/dell-wmi-privacy.c
index 074b7e68c227..c82b3d6867c5 100644
--- a/drivers/platform/x86/dell/dell-wmi-privacy.c
+++ b/drivers/platform/x86/dell/dell-wmi-privacy.c
@@ -174,15 +174,12 @@ static ssize_t dell_privacy_current_state_show(struct device *dev,
 static DEVICE_ATTR_RO(dell_privacy_supported_type);
 static DEVICE_ATTR_RO(dell_privacy_current_state);
 
-static struct attribute *privacy_attributes[] = {
+static struct attribute *privacy_attrs[] = {
 	&dev_attr_dell_privacy_supported_type.attr,
 	&dev_attr_dell_privacy_current_state.attr,
 	NULL,
 };
-
-static const struct attribute_group privacy_attribute_group = {
-	.attrs = privacy_attributes
-};
+ATTRIBUTE_GROUPS(privacy);
 
 /*
  * Describes the Device State class exposed by BIOS which can be consumed by
@@ -342,10 +339,6 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context)
 	if (ret)
 		return ret;
 
-	ret = devm_device_add_group(&wdev->dev, &privacy_attribute_group);
-	if (ret)
-		return ret;
-
 	if (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)) {
 		ret = dell_privacy_leds_setup(&priv->wdev->dev);
 		if (ret)
@@ -374,6 +367,7 @@ static const struct wmi_device_id dell_wmi_privacy_wmi_id_table[] = {
 static struct wmi_driver dell_privacy_wmi_driver = {
 	.driver = {
 		.name = "dell-privacy",
+		.dev_groups = privacy_groups,
 	},
 	.probe = dell_privacy_wmi_probe,
 	.remove = dell_privacy_wmi_remove,
-- 
2.37.1


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

* Re: [PATCH] platform/x86: dell-privacy: convert to use dev_groups
  2022-07-29 11:53 [PATCH] platform/x86: dell-privacy: convert to use dev_groups Greg Kroah-Hartman
@ 2022-08-02 10:52 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-08-02 10:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, platform-driver-x86
  Cc: Perry Yuan, Mark Gross, Dell.Client.Kernel, linux-kernel

Hi,

On 7/29/22 13:53, Greg Kroah-Hartman wrote:
> The driver core supports the ability to handle the creation and removal
> of device-specific sysfs files in a race-free manner.  Take advantage of
> that by converting this driver to use this by moving the sysfs
> attributes into a group and assigning the dev_groups pointer to it.
> 
> Cc: Perry Yuan <Perry.Yuan@dell.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <markgross@kernel.org>
> Cc: Dell.Client.Kernel@dell.com
> Cc: platform-driver-x86@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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.

Patches which are added to review-hans now are intended for
the next rc1. This branch will get rebased to the next rc1 when
it is out and after the rebasing the contents of review-hans
will be pushed to the platform-drivers-x86/for-next branch.

Regards,

Hans

> ---
>  drivers/platform/x86/dell/dell-wmi-privacy.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-privacy.c b/drivers/platform/x86/dell/dell-wmi-privacy.c
> index 074b7e68c227..c82b3d6867c5 100644
> --- a/drivers/platform/x86/dell/dell-wmi-privacy.c
> +++ b/drivers/platform/x86/dell/dell-wmi-privacy.c
> @@ -174,15 +174,12 @@ static ssize_t dell_privacy_current_state_show(struct device *dev,
>  static DEVICE_ATTR_RO(dell_privacy_supported_type);
>  static DEVICE_ATTR_RO(dell_privacy_current_state);
>  
> -static struct attribute *privacy_attributes[] = {
> +static struct attribute *privacy_attrs[] = {
>  	&dev_attr_dell_privacy_supported_type.attr,
>  	&dev_attr_dell_privacy_current_state.attr,
>  	NULL,
>  };
> -
> -static const struct attribute_group privacy_attribute_group = {
> -	.attrs = privacy_attributes
> -};
> +ATTRIBUTE_GROUPS(privacy);
>  
>  /*
>   * Describes the Device State class exposed by BIOS which can be consumed by
> @@ -342,10 +339,6 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context)
>  	if (ret)
>  		return ret;
>  
> -	ret = devm_device_add_group(&wdev->dev, &privacy_attribute_group);
> -	if (ret)
> -		return ret;
> -
>  	if (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)) {
>  		ret = dell_privacy_leds_setup(&priv->wdev->dev);
>  		if (ret)
> @@ -374,6 +367,7 @@ static const struct wmi_device_id dell_wmi_privacy_wmi_id_table[] = {
>  static struct wmi_driver dell_privacy_wmi_driver = {
>  	.driver = {
>  		.name = "dell-privacy",
> +		.dev_groups = privacy_groups,
>  	},
>  	.probe = dell_privacy_wmi_probe,
>  	.remove = dell_privacy_wmi_remove,


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

end of thread, other threads:[~2022-08-02 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 11:53 [PATCH] platform/x86: dell-privacy: convert to use dev_groups Greg Kroah-Hartman
2022-08-02 10:52 ` 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.