Commit 8daf8c3a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

hid: roccat-isku: 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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e0a00d86
...@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = { ...@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = {
&dev_attr_actual_profile.attr, &dev_attr_actual_profile.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(isku);
static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
char *buf, loff_t off, size_t count, char *buf, loff_t off, size_t count,
...@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \ ...@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \
ISKU_SYSFS_W(thingy, THINGY) ISKU_SYSFS_W(thingy, THINGY)
#define ISKU_BIN_ATTR_RW(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 }, \ .attr = { .name = #thingy, .mode = 0660 }, \
.size = ISKU_SIZE_ ## THINGY, \ .size = ISKU_SIZE_ ## THINGY, \
.read = isku_sysfs_read_ ## thingy, \ .read = isku_sysfs_read_ ## thingy, \
...@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY) ...@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY)
} }
#define ISKU_BIN_ATTR_R(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 }, \ .attr = { .name = #thingy, .mode = 0440 }, \
.size = ISKU_SIZE_ ## THINGY, \ .size = ISKU_SIZE_ ## THINGY, \
.read = isku_sysfs_read_ ## thingy, \ .read = isku_sysfs_read_ ## thingy, \
} }
#define ISKU_BIN_ATTR_W(thingy, 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 }, \ .attr = { .name = #thingy, .mode = 0220 }, \
.size = ISKU_SIZE_ ## THINGY, \ .size = ISKU_SIZE_ ## THINGY, \
.write = isku_sysfs_write_ ## thingy \ .write = isku_sysfs_write_ ## thingy \
} }
ISKU_SYSFS_RW(macro, MACRO) ISKU_BIN_ATTR_RW(macro, MACRO);
ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION) ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION);
ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE) ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE);
ISKU_SYSFS_RW(keys_media, KEYS_MEDIA) ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA);
ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER) ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER);
ISKU_SYSFS_RW(keys_macro, KEYS_MACRO) ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO);
ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK) ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK);
ISKU_SYSFS_RW(light, LIGHT) ISKU_BIN_ATTR_RW(light, LIGHT);
ISKU_SYSFS_RW(key_mask, KEY_MASK) ISKU_BIN_ATTR_RW(key_mask, KEY_MASK);
ISKU_SYSFS_RW(last_set, LAST_SET) ISKU_BIN_ATTR_RW(last_set, LAST_SET);
ISKU_SYSFS_W(talk, TALK) ISKU_BIN_ATTR_W(talk, TALK);
ISKU_SYSFS_W(talkfx, TALKFX) ISKU_BIN_ATTR_W(talkfx, TALKFX);
ISKU_SYSFS_R(info, INFO) ISKU_BIN_ATTR_W(control, CONTROL);
ISKU_SYSFS_W(control, CONTROL) ISKU_BIN_ATTR_W(reset, RESET);
ISKU_SYSFS_W(reset, RESET) ISKU_BIN_ATTR_R(info, INFO);
static struct bin_attribute isku_bin_attributes[] = { static struct bin_attribute *isku_bin_attributes[] = {
ISKU_BIN_ATTR_RW(macro, MACRO), &bin_attr_macro,
ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION), &bin_attr_keys_function,
ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE), &bin_attr_keys_easyzone,
ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA), &bin_attr_keys_media,
ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER), &bin_attr_keys_thumbster,
ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO), &bin_attr_keys_macro,
ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK), &bin_attr_keys_capslock,
ISKU_BIN_ATTR_RW(light, LIGHT), &bin_attr_light,
ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), &bin_attr_key_mask,
ISKU_BIN_ATTR_RW(last_set, LAST_SET), &bin_attr_last_set,
ISKU_BIN_ATTR_W(talk, TALK), &bin_attr_talk,
ISKU_BIN_ATTR_W(talkfx, TALKFX), &bin_attr_talkfx,
ISKU_BIN_ATTR_R(info, INFO), &bin_attr_control,
ISKU_BIN_ATTR_W(control, CONTROL), &bin_attr_reset,
ISKU_BIN_ATTR_W(reset, RESET), &bin_attr_info,
__ATTR_NULL 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, static int isku_init_isku_device_struct(struct usb_device *usb_dev,
...@@ -429,7 +441,6 @@ static int __init isku_init(void) ...@@ -429,7 +441,6 @@ static int __init isku_init(void)
if (IS_ERR(isku_class)) if (IS_ERR(isku_class))
return PTR_ERR(isku_class); return PTR_ERR(isku_class);
isku_class->dev_groups = isku_groups; isku_class->dev_groups = isku_groups;
isku_class->dev_bin_attrs = isku_bin_attributes;
retval = hid_register_driver(&isku_driver); retval = hid_register_driver(&isku_driver);
if (retval) if (retval)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment