Skip to content

Commit b4a9af9

Browse files
gregkhJiri Kosina
authored andcommitted
HID: playstation: convert to use dev_groups
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 <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Benjamin Tissoires <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Roderick Colenbrander <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8d9420c commit b4a9af9

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/hid/hid-playstation.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -692,15 +692,12 @@ static ssize_t hardware_version_show(struct device *dev,
692692

693693
static DEVICE_ATTR_RO(hardware_version);
694694

695-
static struct attribute *ps_device_attributes[] = {
695+
static struct attribute *ps_device_attrs[] = {
696696
&dev_attr_firmware_version.attr,
697697
&dev_attr_hardware_version.attr,
698698
NULL
699699
};
700-
701-
static const struct attribute_group ps_device_attribute_group = {
702-
.attrs = ps_device_attributes,
703-
};
700+
ATTRIBUTE_GROUPS(ps_device);
704701

705702
static int dualsense_get_calibration_data(struct dualsense *ds)
706703
{
@@ -1448,12 +1445,6 @@ static int ps_probe(struct hid_device *hdev, const struct hid_device_id *id)
14481445
}
14491446
}
14501447

1451-
ret = devm_device_add_group(&hdev->dev, &ps_device_attribute_group);
1452-
if (ret) {
1453-
hid_err(hdev, "Failed to register sysfs nodes.\n");
1454-
goto err_close;
1455-
}
1456-
14571448
return ret;
14581449

14591450
err_close:
@@ -1487,6 +1478,9 @@ static struct hid_driver ps_driver = {
14871478
.probe = ps_probe,
14881479
.remove = ps_remove,
14891480
.raw_event = ps_raw_event,
1481+
.driver = {
1482+
.dev_groups = ps_device_groups,
1483+
},
14901484
};
14911485

14921486
static int __init ps_init(void)

0 commit comments

Comments
 (0)