diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 08:40:27 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 08:46:53 +0400 |
commit | 080795482566ecaf599bfa8cb5656ff13ca4a4ce (patch) | |
tree | 549c770c2395d426228cca58065d561315ba21fb /drivers/hid/hid-roccat-savu.c | |
parent | 71b230af939ced7d67b65e7060e25d4cb18039ef (diff) | |
download | linux-080795482566ecaf599bfa8cb5656ff13ca4a4ce.tar.xz |
hid: roccat-savu: 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>
Diffstat (limited to 'drivers/hid/hid-roccat-savu.c')
-rw-r--r-- | drivers/hid/hid-roccat-savu.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/hid/hid-roccat-savu.c b/drivers/hid/hid-roccat-savu.c index 31747a29c093..0332267199d5 100644 --- a/drivers/hid/hid-roccat-savu.c +++ b/drivers/hid/hid-roccat-savu.c @@ -94,44 +94,48 @@ SAVU_SYSFS_W(thingy, THINGY) \ SAVU_SYSFS_R(thingy, THINGY) #define SAVU_BIN_ATTRIBUTE_RW(thingy, THINGY) \ -{ \ +SAVU_SYSFS_RW(thingy, THINGY); \ +static struct bin_attribute bin_attr_##thingy = { \ .attr = { .name = #thingy, .mode = 0660 }, \ .size = SAVU_SIZE_ ## THINGY, \ .read = savu_sysfs_read_ ## thingy, \ .write = savu_sysfs_write_ ## thingy \ } -#define SAVU_BIN_ATTRIBUTE_R(thingy, THINGY) \ -{ \ - .attr = { .name = #thingy, .mode = 0440 }, \ - .size = SAVU_SIZE_ ## THINGY, \ - .read = savu_sysfs_read_ ## thingy, \ -} - #define SAVU_BIN_ATTRIBUTE_W(thingy, THINGY) \ -{ \ +SAVU_SYSFS_W(thingy, THINGY); \ +static struct bin_attribute bin_attr_##thingy = { \ .attr = { .name = #thingy, .mode = 0220 }, \ .size = SAVU_SIZE_ ## THINGY, \ .write = savu_sysfs_write_ ## thingy \ } -SAVU_SYSFS_W(control, CONTROL) -SAVU_SYSFS_RW(profile, PROFILE) -SAVU_SYSFS_RW(general, GENERAL) -SAVU_SYSFS_RW(buttons, BUTTONS) -SAVU_SYSFS_RW(macro, MACRO) -SAVU_SYSFS_RW(info, INFO) -SAVU_SYSFS_RW(sensor, SENSOR) - -static struct bin_attribute savu_bin_attributes[] = { - SAVU_BIN_ATTRIBUTE_W(control, CONTROL), - SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE), - SAVU_BIN_ATTRIBUTE_RW(general, GENERAL), - SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS), - SAVU_BIN_ATTRIBUTE_RW(macro, MACRO), - SAVU_BIN_ATTRIBUTE_RW(info, INFO), - SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR), - __ATTR_NULL +SAVU_BIN_ATTRIBUTE_W(control, CONTROL); +SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE); +SAVU_BIN_ATTRIBUTE_RW(general, GENERAL); +SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS); +SAVU_BIN_ATTRIBUTE_RW(macro, MACRO); +SAVU_BIN_ATTRIBUTE_RW(info, INFO); +SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR); + +static struct bin_attribute *savu_bin_attributes[] = { + &bin_attr_control, + &bin_attr_profile, + &bin_attr_general, + &bin_attr_buttons, + &bin_attr_macro, + &bin_attr_info, + &bin_attr_sensor, + NULL, +}; + +static const struct attribute_group savu_group = { + .bin_attrs = savu_bin_attributes, +}; + +static const struct attribute_group *savu_groups[] = { + &savu_group, + NULL, }; static int savu_init_savu_device_struct(struct usb_device *usb_dev, @@ -294,7 +298,7 @@ static int __init savu_init(void) savu_class = class_create(THIS_MODULE, "savu"); if (IS_ERR(savu_class)) return PTR_ERR(savu_class); - savu_class->dev_bin_attrs = savu_bin_attributes; + savu_class->dev_groups = savu_groups; retval = hid_register_driver(&savu_driver); if (retval) |