* [PATCH] HID: playstation: convert to use dev_groups
@ 2022-08-04 11:30 Greg Kroah-Hartman
2022-08-12 15:59 ` Roderick Colenbrander
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-04 11:30 UTC (permalink / raw)
To: jikos, benjamin.tissoires
Cc: Greg Kroah-Hartman, Roderick Colenbrander, linux-input, linux-kernel
There is no need for a driver to individually add/create device groups,
the driver core will do it automatically for you. Convert the
hid-playstation driver to use the dev_groups pointer instead of manually
calling the driver core to create the group and have it be cleaned up
later on by the devm core.
Cc: Roderick Colenbrander <roderick.colenbrander@sony.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hid/hid-playstation.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index b1b5721b5d8f..40050eb85c0a 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -692,15 +692,12 @@ static ssize_t hardware_version_show(struct device *dev,
static DEVICE_ATTR_RO(hardware_version);
-static struct attribute *ps_device_attributes[] = {
+static struct attribute *ps_device_attrs[] = {
&dev_attr_firmware_version.attr,
&dev_attr_hardware_version.attr,
NULL
};
-
-static const struct attribute_group ps_device_attribute_group = {
- .attrs = ps_device_attributes,
-};
+ATTRIBUTE_GROUPS(ps_device);
static int dualsense_get_calibration_data(struct dualsense *ds)
{
@@ -1448,12 +1445,6 @@ static int ps_probe(struct hid_device *hdev, const struct hid_device_id *id)
}
}
- ret = devm_device_add_group(&hdev->dev, &ps_device_attribute_group);
- if (ret) {
- hid_err(hdev, "Failed to register sysfs nodes.\n");
- goto err_close;
- }
-
return ret;
err_close:
@@ -1487,6 +1478,9 @@ static struct hid_driver ps_driver = {
.probe = ps_probe,
.remove = ps_remove,
.raw_event = ps_raw_event,
+ .driver = {
+ .dev_groups = ps_device_groups,
+ },
};
static int __init ps_init(void)
--
2.37.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: playstation: convert to use dev_groups
2022-08-04 11:30 [PATCH] HID: playstation: convert to use dev_groups Greg Kroah-Hartman
@ 2022-08-12 15:59 ` Roderick Colenbrander
2022-08-25 8:36 ` Jiri Kosina
0 siblings, 1 reply; 4+ messages in thread
From: Roderick Colenbrander @ 2022-08-12 15:59 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Kosina, Benjamin Tissoires, Roderick Colenbrander,
linux-input, lkml
Hi Greg,
Thanks for the patch. It looks good and confirmed it working properly.
(Replying from personal email... corporate email systems *Exchange*
don't work well with GIT)
Acked-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Thanks,
Roderick Colenbrander
On Thu, Aug 4, 2022 at 4:32 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> There is no need for a driver to individually add/create device groups,
> the driver core will do it automatically for you. Convert the
> hid-playstation driver to use the dev_groups pointer instead of manually
> calling the driver core to create the group and have it be cleaned up
> later on by the devm core.
>
> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: linux-input@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/hid/hid-playstation.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index b1b5721b5d8f..40050eb85c0a 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -692,15 +692,12 @@ static ssize_t hardware_version_show(struct device *dev,
>
> static DEVICE_ATTR_RO(hardware_version);
>
> -static struct attribute *ps_device_attributes[] = {
> +static struct attribute *ps_device_attrs[] = {
> &dev_attr_firmware_version.attr,
> &dev_attr_hardware_version.attr,
> NULL
> };
> -
> -static const struct attribute_group ps_device_attribute_group = {
> - .attrs = ps_device_attributes,
> -};
> +ATTRIBUTE_GROUPS(ps_device);
>
> static int dualsense_get_calibration_data(struct dualsense *ds)
> {
> @@ -1448,12 +1445,6 @@ static int ps_probe(struct hid_device *hdev, const struct hid_device_id *id)
> }
> }
>
> - ret = devm_device_add_group(&hdev->dev, &ps_device_attribute_group);
> - if (ret) {
> - hid_err(hdev, "Failed to register sysfs nodes.\n");
> - goto err_close;
> - }
> -
> return ret;
>
> err_close:
> @@ -1487,6 +1478,9 @@ static struct hid_driver ps_driver = {
> .probe = ps_probe,
> .remove = ps_remove,
> .raw_event = ps_raw_event,
> + .driver = {
> + .dev_groups = ps_device_groups,
> + },
> };
>
> static int __init ps_init(void)
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: playstation: convert to use dev_groups
2022-08-12 15:59 ` Roderick Colenbrander
@ 2022-08-25 8:36 ` Jiri Kosina
2022-08-25 9:02 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2022-08-25 8:36 UTC (permalink / raw)
To: Roderick Colenbrander
Cc: Greg Kroah-Hartman, Benjamin Tissoires, Roderick Colenbrander,
linux-input, lkml
On Fri, 12 Aug 2022, Roderick Colenbrander wrote:
> Hi Greg,
>
> Thanks for the patch. It looks good and confirmed it working properly.
> (Replying from personal email... corporate email systems *Exchange*
> don't work well with GIT)
>
> Acked-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Sorry for the delay, was off for a bit. Queued in for-6.1/sony.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: playstation: convert to use dev_groups
2022-08-25 8:36 ` Jiri Kosina
@ 2022-08-25 9:02 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-25 9:02 UTC (permalink / raw)
To: Jiri Kosina
Cc: Roderick Colenbrander, Benjamin Tissoires, Roderick Colenbrander,
linux-input, lkml
On Thu, Aug 25, 2022 at 10:36:52AM +0200, Jiri Kosina wrote:
> On Fri, 12 Aug 2022, Roderick Colenbrander wrote:
>
> > Hi Greg,
> >
> > Thanks for the patch. It looks good and confirmed it working properly.
> > (Replying from personal email... corporate email systems *Exchange*
> > don't work well with GIT)
> >
> > Acked-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
>
> Sorry for the delay, was off for a bit. Queued in for-6.1/sony.
No worries, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-25 9:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 11:30 [PATCH] HID: playstation: convert to use dev_groups Greg Kroah-Hartman
2022-08-12 15:59 ` Roderick Colenbrander
2022-08-25 8:36 ` Jiri Kosina
2022-08-25 9:02 ` Greg Kroah-Hartman
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.