diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 00:40:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 00:46:53 -0400 |
commit | 8daf8c3aa6b4cad8ec5b286c75c3115d7fbf3fdf (patch) | |
tree | 4698c0a636b8e6558bf28a9f30fa83a268677664 /drivers/hid/hid-roccat-isku.c | |
parent | e0a00d86000729caf3a3e60732723183ebb6b144 (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.c | 87 |
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 | }; |
119 | ATTRIBUTE_GROUPS(isku); | ||
120 | 119 | ||
121 | static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, | 120 | static 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) \ | |||
185 | ISKU_SYSFS_W(thingy, THINGY) | 184 | ISKU_SYSFS_W(thingy, THINGY) |
186 | 185 | ||
187 | #define ISKU_BIN_ATTR_RW(thingy, THINGY) \ | 186 | #define ISKU_BIN_ATTR_RW(thingy, THINGY) \ |
188 | { \ | 187 | ISKU_SYSFS_RW(thingy, THINGY); \ |
188 | static 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 | { \ | 196 | ISKU_SYSFS_R(thingy, THINGY); \ |
197 | static 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 | { \ | 204 | ISKU_SYSFS_W(thingy, THINGY); \ |
205 | static 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 | ||
209 | ISKU_SYSFS_RW(macro, MACRO) | 211 | ISKU_BIN_ATTR_RW(macro, MACRO); |
210 | ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION) | 212 | ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION); |
211 | ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE) | 213 | ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE); |
212 | ISKU_SYSFS_RW(keys_media, KEYS_MEDIA) | 214 | ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA); |
213 | ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER) | 215 | ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER); |
214 | ISKU_SYSFS_RW(keys_macro, KEYS_MACRO) | 216 | ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO); |
215 | ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK) | 217 | ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK); |
216 | ISKU_SYSFS_RW(light, LIGHT) | 218 | ISKU_BIN_ATTR_RW(light, LIGHT); |
217 | ISKU_SYSFS_RW(key_mask, KEY_MASK) | 219 | ISKU_BIN_ATTR_RW(key_mask, KEY_MASK); |
218 | ISKU_SYSFS_RW(last_set, LAST_SET) | 220 | ISKU_BIN_ATTR_RW(last_set, LAST_SET); |
219 | ISKU_SYSFS_W(talk, TALK) | 221 | ISKU_BIN_ATTR_W(talk, TALK); |
220 | ISKU_SYSFS_W(talkfx, TALKFX) | 222 | ISKU_BIN_ATTR_W(talkfx, TALKFX); |
221 | ISKU_SYSFS_R(info, INFO) | 223 | ISKU_BIN_ATTR_W(control, CONTROL); |
222 | ISKU_SYSFS_W(control, CONTROL) | 224 | ISKU_BIN_ATTR_W(reset, RESET); |
223 | ISKU_SYSFS_W(reset, RESET) | 225 | ISKU_BIN_ATTR_R(info, INFO); |
224 | 226 | ||
225 | static struct bin_attribute isku_bin_attributes[] = { | 227 | static 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 | |||
246 | static const struct attribute_group isku_group = { | ||
247 | .attrs = isku_attrs, | ||
248 | .bin_attrs = isku_bin_attributes, | ||
249 | }; | ||
250 | |||
251 | static const struct attribute_group *isku_groups[] = { | ||
252 | &isku_group, | ||
253 | NULL, | ||
242 | }; | 254 | }; |
243 | 255 | ||
244 | static int isku_init_isku_device_struct(struct usb_device *usb_dev, | 256 | static 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) |