hid: roccat-isku: convert class code to use bin_attrs in groups
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Aug 2013 04:40:26 +0000 (21:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Aug 2013 04:46:53 +0000 (21:46 -0700)
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>
drivers/hid/hid-roccat-isku.c

index 3983dec..b7a4e10 100644 (file)
@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = {
        &dev_attr_actual_profile.attr,
        NULL,
 };
-ATTRIBUTE_GROUPS(isku);
 
 static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
                char *buf, loff_t off, size_t count,
@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \
 ISKU_SYSFS_W(thingy, THINGY)
 
 #define ISKU_BIN_ATTR_RW(thingy, THINGY) \
-{ \
+ISKU_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
        .attr = { .name = #thingy, .mode = 0660 }, \
        .size = ISKU_SIZE_ ## THINGY, \
        .read = isku_sysfs_read_ ## thingy, \
@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY)
 }
 
 #define ISKU_BIN_ATTR_R(thingy, THINGY) \
-{ \
+ISKU_SYSFS_R(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
        .attr = { .name = #thingy, .mode = 0440 }, \
        .size = ISKU_SIZE_ ## THINGY, \
        .read = isku_sysfs_read_ ## thingy, \
 }
 
 #define ISKU_BIN_ATTR_W(thingy, THINGY) \
-{ \
+ISKU_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
        .attr = { .name = #thingy, .mode = 0220 }, \
        .size = ISKU_SIZE_ ## THINGY, \
        .write = isku_sysfs_write_ ## thingy \
 }
 
-ISKU_SYSFS_RW(macro, MACRO)
-ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION)
-ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE)
-ISKU_SYSFS_RW(keys_media, KEYS_MEDIA)
-ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER)
-ISKU_SYSFS_RW(keys_macro, KEYS_MACRO)
-ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK)
-ISKU_SYSFS_RW(light, LIGHT)
-ISKU_SYSFS_RW(key_mask, KEY_MASK)
-ISKU_SYSFS_RW(last_set, LAST_SET)
-ISKU_SYSFS_W(talk, TALK)
-ISKU_SYSFS_W(talkfx, TALKFX)
-ISKU_SYSFS_R(info, INFO)
-ISKU_SYSFS_W(control, CONTROL)
-ISKU_SYSFS_W(reset, RESET)
-
-static struct bin_attribute isku_bin_attributes[] = {
-       ISKU_BIN_ATTR_RW(macro, MACRO),
-       ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION),
-       ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE),
-       ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA),
-       ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER),
-       ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO),
-       ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK),
-       ISKU_BIN_ATTR_RW(light, LIGHT),
-       ISKU_BIN_ATTR_RW(key_mask, KEY_MASK),
-       ISKU_BIN_ATTR_RW(last_set, LAST_SET),
-       ISKU_BIN_ATTR_W(talk, TALK),
-       ISKU_BIN_ATTR_W(talkfx, TALKFX),
-       ISKU_BIN_ATTR_R(info, INFO),
-       ISKU_BIN_ATTR_W(control, CONTROL),
-       ISKU_BIN_ATTR_W(reset, RESET),
-       __ATTR_NULL
+ISKU_BIN_ATTR_RW(macro, MACRO);
+ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION);
+ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE);
+ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA);
+ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER);
+ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO);
+ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK);
+ISKU_BIN_ATTR_RW(light, LIGHT);
+ISKU_BIN_ATTR_RW(key_mask, KEY_MASK);
+ISKU_BIN_ATTR_RW(last_set, LAST_SET);
+ISKU_BIN_ATTR_W(talk, TALK);
+ISKU_BIN_ATTR_W(talkfx, TALKFX);
+ISKU_BIN_ATTR_W(control, CONTROL);
+ISKU_BIN_ATTR_W(reset, RESET);
+ISKU_BIN_ATTR_R(info, INFO);
+
+static struct bin_attribute *isku_bin_attributes[] = {
+       &bin_attr_macro,
+       &bin_attr_keys_function,
+       &bin_attr_keys_easyzone,
+       &bin_attr_keys_media,
+       &bin_attr_keys_thumbster,
+       &bin_attr_keys_macro,
+       &bin_attr_keys_capslock,
+       &bin_attr_light,
+       &bin_attr_key_mask,
+       &bin_attr_last_set,
+       &bin_attr_talk,
+       &bin_attr_talkfx,
+       &bin_attr_control,
+       &bin_attr_reset,
+       &bin_attr_info,
+       NULL,
+};
+
+static const struct attribute_group isku_group = {
+       .attrs = isku_attrs,
+       .bin_attrs = isku_bin_attributes,
+};
+
+static const struct attribute_group *isku_groups[] = {
+       &isku_group,
+       NULL,
 };
 
 static int isku_init_isku_device_struct(struct usb_device *usb_dev,
@@ -429,7 +441,6 @@ static int __init isku_init(void)
        if (IS_ERR(isku_class))
                return PTR_ERR(isku_class);
        isku_class->dev_groups = isku_groups;
-       isku_class->dev_bin_attrs = isku_bin_attributes;
 
        retval = hid_register_driver(&isku_driver);
        if (retval)