summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-vivaldi-common.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-04 13:31:16 +0200
committerJiri Kosina <jkosina@suse.cz>2022-08-25 11:37:21 +0200
commit9f4441fcbb7219b4e6ea4554f404209a433d4f52 (patch)
tree5e4971bb137c34123067f3eafe1480a8dc722a67 /drivers/hid/hid-vivaldi-common.c
parent8d9420ca9bd9bceddcfab3d0263d6a8e073396fe (diff)
downloadlinux-stable-9f4441fcbb7219b4e6ea4554f404209a433d4f52.tar.gz
linux-stable-9f4441fcbb7219b4e6ea4554f404209a433d4f52.tar.bz2
linux-stable-9f4441fcbb7219b4e6ea4554f404209a433d4f52.zip
HID: vivaldi: 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-vivaldi core 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: 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> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-vivaldi-common.c')
-rw-r--r--drivers/hid/hid-vivaldi-common.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index 8b3e515d0f06..b0af2be94895 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -116,25 +116,26 @@ static struct attribute *vivaldi_sysfs_attrs[] = {
NULL
};
-static const struct attribute_group vivaldi_attribute_group = {
- .attrs = vivaldi_sysfs_attrs,
-};
-
-/**
- * vivaldi_input_configured - Complete initialization of device using vivaldi map
- * @hdev: HID device to which vivaldi attributes should be attached
- * @hidinput: HID input device (unused)
- */
-int vivaldi_input_configured(struct hid_device *hdev,
- struct hid_input *hidinput)
+static umode_t vivaldi_is_visible(struct kobject *kobj, struct attribute *attr,
+ int n)
{
+ struct hid_device *hdev = to_hid_device(kobj_to_dev(kobj));
struct vivaldi_data *data = hid_get_drvdata(hdev);
if (!data->num_function_row_keys)
return 0;
-
- return devm_device_add_group(&hdev->dev, &vivaldi_attribute_group);
+ return attr->mode;
}
-EXPORT_SYMBOL_GPL(vivaldi_input_configured);
+
+static const struct attribute_group vivaldi_attribute_group = {
+ .attrs = vivaldi_sysfs_attrs,
+ .is_visible = vivaldi_is_visible,
+};
+
+const struct attribute_group *vivaldi_attribute_groups[] = {
+ &vivaldi_attribute_group,
+ NULL,
+};
+EXPORT_SYMBOL_GPL(vivaldi_attribute_groups);
MODULE_LICENSE("GPL");