diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-19 21:40:26 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-19 21:46:53 -0700 |
commit | e0a00d86000729caf3a3e60732723183ebb6b144 (patch) | |
tree | 70a9430bb704bda296a632a9da2440bc9b1d72e9 | |
parent | d9e1241e469bbd4b483e0996e404fdce46735b48 (diff) | |
download | lwn-e0a00d86000729caf3a3e60732723183ebb6b144.tar.gz lwn-e0a00d86000729caf3a3e60732723183ebb6b144.zip |
hid: roccat-arvo: convert class code to use bin_attrs in groups
Now that attribute groups support binary attributes, use them instead of
the dev_bin_attrs field in struct class, as that is going away soon.
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/hid/hid-roccat-arvo.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c index 98bb89e0d91b..eed7f52084c5 100644 --- a/drivers/hid/hid-roccat-arvo.c +++ b/drivers/hid/hid-roccat-arvo.c @@ -237,6 +237,8 @@ static ssize_t arvo_sysfs_write_button(struct file *fp, return arvo_sysfs_write(fp, kobj, buf, off, count, sizeof(struct arvo_button), ARVO_COMMAND_BUTTON); } +static BIN_ATTR(button, 0220, NULL, arvo_sysfs_write_button, + sizeof(struct arvo_button)); static ssize_t arvo_sysfs_read_info(struct file *fp, struct kobject *kobj, struct bin_attribute *attr, char *buf, @@ -245,6 +247,8 @@ static ssize_t arvo_sysfs_read_info(struct file *fp, return arvo_sysfs_read(fp, kobj, buf, off, count, sizeof(struct arvo_info), ARVO_COMMAND_INFO); } +static BIN_ATTR(info, 0440, arvo_sysfs_read_info, NULL, + sizeof(struct arvo_info)); static struct attribute *arvo_attrs[] = { &dev_attr_mode_key.attr, @@ -252,20 +256,21 @@ static struct attribute *arvo_attrs[] = { &dev_attr_actual_profile.attr, NULL, }; -ATTRIBUTE_GROUPS(arvo); - -static struct bin_attribute arvo_bin_attributes[] = { - { - .attr = { .name = "button", .mode = 0220 }, - .size = sizeof(struct arvo_button), - .write = arvo_sysfs_write_button - }, - { - .attr = { .name = "info", .mode = 0440 }, - .size = sizeof(struct arvo_info), - .read = arvo_sysfs_read_info - }, - __ATTR_NULL + +static struct bin_attribute *arvo_bin_attributes[] = { + &bin_attr_button, + &bin_attr_info, + NULL, +}; + +static const struct attribute_group arvo_group = { + .attrs = arvo_attrs, + .bin_attrs = arvo_bin_attributes, +}; + +static const struct attribute_group *arvo_groups[] = { + &arvo_group, + NULL, }; static int arvo_init_arvo_device_struct(struct usb_device *usb_dev, @@ -434,7 +439,6 @@ static int __init arvo_init(void) if (IS_ERR(arvo_class)) return PTR_ERR(arvo_class); arvo_class->dev_groups = arvo_groups; - arvo_class->dev_bin_attrs = arvo_bin_attributes; retval = hid_register_driver(&arvo_driver); if (retval) |