aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat-arvo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-roccat-arvo.c')
-rw-r--r--drivers/hid/hid-roccat-arvo.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c
index 327f9b8ed1f4..eed7f52084c5 100644
--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -75,6 +75,8 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
75 75
76 return size; 76 return size;
77} 77}
78static DEVICE_ATTR(mode_key, 0660,
79 arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key);
78 80
79static ssize_t arvo_sysfs_show_key_mask(struct device *dev, 81static ssize_t arvo_sysfs_show_key_mask(struct device *dev,
80 struct device_attribute *attr, char *buf) 82 struct device_attribute *attr, char *buf)
@@ -123,6 +125,8 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
123 125
124 return size; 126 return size;
125} 127}
128static DEVICE_ATTR(key_mask, 0660,
129 arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask);
126 130
127/* retval is 1-5 on success, < 0 on error */ 131/* retval is 1-5 on success, < 0 on error */
128static int arvo_get_actual_profile(struct usb_device *usb_dev) 132static int arvo_get_actual_profile(struct usb_device *usb_dev)
@@ -179,6 +183,9 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,
179 mutex_unlock(&arvo->arvo_lock); 183 mutex_unlock(&arvo->arvo_lock);
180 return retval; 184 return retval;
181} 185}
186static DEVICE_ATTR(actual_profile, 0660,
187 arvo_sysfs_show_actual_profile,
188 arvo_sysfs_set_actual_profile);
182 189
183static ssize_t arvo_sysfs_write(struct file *fp, 190static ssize_t arvo_sysfs_write(struct file *fp,
184 struct kobject *kobj, void const *buf, 191 struct kobject *kobj, void const *buf,
@@ -230,6 +237,8 @@ static ssize_t arvo_sysfs_write_button(struct file *fp,
230 return arvo_sysfs_write(fp, kobj, buf, off, count, 237 return arvo_sysfs_write(fp, kobj, buf, off, count,
231 sizeof(struct arvo_button), ARVO_COMMAND_BUTTON); 238 sizeof(struct arvo_button), ARVO_COMMAND_BUTTON);
232} 239}
240static BIN_ATTR(button, 0220, NULL, arvo_sysfs_write_button,
241 sizeof(struct arvo_button));
233 242
234static ssize_t arvo_sysfs_read_info(struct file *fp, 243static ssize_t arvo_sysfs_read_info(struct file *fp,
235 struct kobject *kobj, struct bin_attribute *attr, char *buf, 244 struct kobject *kobj, struct bin_attribute *attr, char *buf,
@@ -238,31 +247,30 @@ static ssize_t arvo_sysfs_read_info(struct file *fp,
238 return arvo_sysfs_read(fp, kobj, buf, off, count, 247 return arvo_sysfs_read(fp, kobj, buf, off, count,
239 sizeof(struct arvo_info), ARVO_COMMAND_INFO); 248 sizeof(struct arvo_info), ARVO_COMMAND_INFO);
240} 249}
250static BIN_ATTR(info, 0440, arvo_sysfs_read_info, NULL,
251 sizeof(struct arvo_info));
252
253static struct attribute *arvo_attrs[] = {
254 &dev_attr_mode_key.attr,
255 &dev_attr_key_mask.attr,
256 &dev_attr_actual_profile.attr,
257 NULL,
258};
241 259
260static struct bin_attribute *arvo_bin_attributes[] = {
261 &bin_attr_button,
262 &bin_attr_info,
263 NULL,
264};
242 265
243static struct device_attribute arvo_attributes[] = { 266static const struct attribute_group arvo_group = {
244 __ATTR(mode_key, 0660, 267 .attrs = arvo_attrs,
245 arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key), 268 .bin_attrs = arvo_bin_attributes,
246 __ATTR(key_mask, 0660,
247 arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask),
248 __ATTR(actual_profile, 0660,
249 arvo_sysfs_show_actual_profile,
250 arvo_sysfs_set_actual_profile),
251 __ATTR_NULL
252}; 269};
253 270
254static struct bin_attribute arvo_bin_attributes[] = { 271static const struct attribute_group *arvo_groups[] = {
255 { 272 &arvo_group,
256 .attr = { .name = "button", .mode = 0220 }, 273 NULL,
257 .size = sizeof(struct arvo_button),
258 .write = arvo_sysfs_write_button
259 },
260 {
261 .attr = { .name = "info", .mode = 0440 },
262 .size = sizeof(struct arvo_info),
263 .read = arvo_sysfs_read_info
264 },
265 __ATTR_NULL
266}; 274};
267 275
268static int arvo_init_arvo_device_struct(struct usb_device *usb_dev, 276static int arvo_init_arvo_device_struct(struct usb_device *usb_dev,
@@ -430,8 +438,7 @@ static int __init arvo_init(void)
430 arvo_class = class_create(THIS_MODULE, "arvo"); 438 arvo_class = class_create(THIS_MODULE, "arvo");
431 if (IS_ERR(arvo_class)) 439 if (IS_ERR(arvo_class))
432 return PTR_ERR(arvo_class); 440 return PTR_ERR(arvo_class);
433 arvo_class->dev_attrs = arvo_attributes; 441 arvo_class->dev_groups = arvo_groups;
434 arvo_class->dev_bin_attrs = arvo_bin_attributes;
435 442
436 retval = hid_register_driver(&arvo_driver); 443 retval = hid_register_driver(&arvo_driver);
437 if (retval) 444 if (retval)