aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat-isku.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-20 00:40:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-20 00:46:53 -0400
commit8daf8c3aa6b4cad8ec5b286c75c3115d7fbf3fdf (patch)
tree4698c0a636b8e6558bf28a9f30fa83a268677664 /drivers/hid/hid-roccat-isku.c
parente0a00d86000729caf3a3e60732723183ebb6b144 (diff)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/hid-roccat-isku.c')
-rw-r--r--drivers/hid/hid-roccat-isku.c87
1 files changed, 49 insertions, 38 deletions
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c
index 3983dec062d7..b7a4e10e112e 100644
--- a/drivers/hid/hid-roccat-isku.c
+++ b/drivers/hid/hid-roccat-isku.c
@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = {
116 &dev_attr_actual_profile.attr, 116 &dev_attr_actual_profile.attr,
117 NULL, 117 NULL,
118}; 118};
119ATTRIBUTE_GROUPS(isku);
120 119
121static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, 120static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
122 char *buf, loff_t off, size_t count, 121 char *buf, loff_t off, size_t count,
@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \
185ISKU_SYSFS_W(thingy, THINGY) 184ISKU_SYSFS_W(thingy, THINGY)
186 185
187#define ISKU_BIN_ATTR_RW(thingy, THINGY) \ 186#define ISKU_BIN_ATTR_RW(thingy, THINGY) \
188{ \ 187ISKU_SYSFS_RW(thingy, THINGY); \
188static struct bin_attribute bin_attr_##thingy = { \
189 .attr = { .name = #thingy, .mode = 0660 }, \ 189 .attr = { .name = #thingy, .mode = 0660 }, \
190 .size = ISKU_SIZE_ ## THINGY, \ 190 .size = ISKU_SIZE_ ## THINGY, \
191 .read = isku_sysfs_read_ ## thingy, \ 191 .read = isku_sysfs_read_ ## thingy, \
@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY)
193} 193}
194 194
195#define ISKU_BIN_ATTR_R(thingy, THINGY) \ 195#define ISKU_BIN_ATTR_R(thingy, THINGY) \
196{ \ 196ISKU_SYSFS_R(thingy, THINGY); \
197static struct bin_attribute bin_attr_##thingy = { \
197 .attr = { .name = #thingy, .mode = 0440 }, \ 198 .attr = { .name = #thingy, .mode = 0440 }, \
198 .size = ISKU_SIZE_ ## THINGY, \ 199 .size = ISKU_SIZE_ ## THINGY, \
199 .read = isku_sysfs_read_ ## thingy, \ 200 .read = isku_sysfs_read_ ## thingy, \
200} 201}
201 202
202#define ISKU_BIN_ATTR_W(thingy, THINGY) \ 203#define ISKU_BIN_ATTR_W(thingy, THINGY) \
203{ \ 204ISKU_SYSFS_W(thingy, THINGY); \
205static struct bin_attribute bin_attr_##thingy = { \
204 .attr = { .name = #thingy, .mode = 0220 }, \ 206 .attr = { .name = #thingy, .mode = 0220 }, \
205 .size = ISKU_SIZE_ ## THINGY, \ 207 .size = ISKU_SIZE_ ## THINGY, \
206 .write = isku_sysfs_write_ ## thingy \ 208 .write = isku_sysfs_write_ ## thingy \
207} 209}
208 210
209ISKU_SYSFS_RW(macro, MACRO) 211ISKU_BIN_ATTR_RW(macro, MACRO);
210ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION) 212ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION);
211ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE) 213ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE);
212ISKU_SYSFS_RW(keys_media, KEYS_MEDIA) 214ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA);
213ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER) 215ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER);
214ISKU_SYSFS_RW(keys_macro, KEYS_MACRO) 216ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO);
215ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK) 217ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK);
216ISKU_SYSFS_RW(light, LIGHT) 218ISKU_BIN_ATTR_RW(light, LIGHT);
217ISKU_SYSFS_RW(key_mask, KEY_MASK) 219ISKU_BIN_ATTR_RW(key_mask, KEY_MASK);
218ISKU_SYSFS_RW(last_set, LAST_SET) 220ISKU_BIN_ATTR_RW(last_set, LAST_SET);
219ISKU_SYSFS_W(talk, TALK) 221ISKU_BIN_ATTR_W(talk, TALK);
220ISKU_SYSFS_W(talkfx, TALKFX) 222ISKU_BIN_ATTR_W(talkfx, TALKFX);
221ISKU_SYSFS_R(info, INFO) 223ISKU_BIN_ATTR_W(control, CONTROL);
222ISKU_SYSFS_W(control, CONTROL) 224ISKU_BIN_ATTR_W(reset, RESET);
223ISKU_SYSFS_W(reset, RESET) 225ISKU_BIN_ATTR_R(info, INFO);
224 226
225static struct bin_attribute isku_bin_attributes[] = { 227static struct bin_attribute *isku_bin_attributes[] = {
226 ISKU_BIN_ATTR_RW(macro, MACRO), 228 &bin_attr_macro,
227 ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION), 229 &bin_attr_keys_function,
228 ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE), 230 &bin_attr_keys_easyzone,
229 ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA), 231 &bin_attr_keys_media,
230 ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER), 232 &bin_attr_keys_thumbster,
231 ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO), 233 &bin_attr_keys_macro,
232 ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK), 234 &bin_attr_keys_capslock,
233 ISKU_BIN_ATTR_RW(light, LIGHT), 235 &bin_attr_light,
234 ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), 236 &bin_attr_key_mask,
235 ISKU_BIN_ATTR_RW(last_set, LAST_SET), 237 &bin_attr_last_set,
236 ISKU_BIN_ATTR_W(talk, TALK), 238 &bin_attr_talk,
237 ISKU_BIN_ATTR_W(talkfx, TALKFX), 239 &bin_attr_talkfx,
238 ISKU_BIN_ATTR_R(info, INFO), 240 &bin_attr_control,
239 ISKU_BIN_ATTR_W(control, CONTROL), 241 &bin_attr_reset,
240 ISKU_BIN_ATTR_W(reset, RESET), 242 &bin_attr_info,
241 __ATTR_NULL 243 NULL,
244};
245
246static const struct attribute_group isku_group = {
247 .attrs = isku_attrs,
248 .bin_attrs = isku_bin_attributes,
249};
250
251static const struct attribute_group *isku_groups[] = {
252 &isku_group,
253 NULL,
242}; 254};
243 255
244static int isku_init_isku_device_struct(struct usb_device *usb_dev, 256static int isku_init_isku_device_struct(struct usb_device *usb_dev,
@@ -429,7 +441,6 @@ static int __init isku_init(void)
429 if (IS_ERR(isku_class)) 441 if (IS_ERR(isku_class))
430 return PTR_ERR(isku_class); 442 return PTR_ERR(isku_class);
431 isku_class->dev_groups = isku_groups; 443 isku_class->dev_groups = isku_groups;
432 isku_class->dev_bin_attrs = isku_bin_attributes;
433 444
434 retval = hid_register_driver(&isku_driver); 445 retval = hid_register_driver(&isku_driver);
435 if (retval) 446 if (retval)