aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-roccat-arvo.c25
-rw-r--r--drivers/hid/hid-roccat-isku.c13
-rw-r--r--drivers/hid/hid-roccat-kone.c30
-rw-r--r--drivers/hid/hid-roccat-koneplus.c28
-rw-r--r--drivers/hid/hid-roccat-kovaplus.c33
-rw-r--r--drivers/hid/hid-roccat-pyra.c24
6 files changed, 88 insertions, 65 deletions
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c
index 327f9b8ed1f4..98bb89e0d91b 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,
@@ -239,17 +246,13 @@ static ssize_t arvo_sysfs_read_info(struct file *fp,
239 sizeof(struct arvo_info), ARVO_COMMAND_INFO); 246 sizeof(struct arvo_info), ARVO_COMMAND_INFO);
240} 247}
241 248
242 249static struct attribute *arvo_attrs[] = {
243static struct device_attribute arvo_attributes[] = { 250 &dev_attr_mode_key.attr,
244 __ATTR(mode_key, 0660, 251 &dev_attr_key_mask.attr,
245 arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key), 252 &dev_attr_actual_profile.attr,
246 __ATTR(key_mask, 0660, 253 NULL,
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}; 254};
255ATTRIBUTE_GROUPS(arvo);
253 256
254static struct bin_attribute arvo_bin_attributes[] = { 257static struct bin_attribute arvo_bin_attributes[] = {
255 { 258 {
@@ -430,7 +433,7 @@ static int __init arvo_init(void)
430 arvo_class = class_create(THIS_MODULE, "arvo"); 433 arvo_class = class_create(THIS_MODULE, "arvo");
431 if (IS_ERR(arvo_class)) 434 if (IS_ERR(arvo_class))
432 return PTR_ERR(arvo_class); 435 return PTR_ERR(arvo_class);
433 arvo_class->dev_attrs = arvo_attributes; 436 arvo_class->dev_groups = arvo_groups;
434 arvo_class->dev_bin_attrs = arvo_bin_attributes; 437 arvo_class->dev_bin_attrs = arvo_bin_attributes;
435 438
436 retval = hid_register_driver(&arvo_driver); 439 retval = hid_register_driver(&arvo_driver);
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c
index 8023751d5257..3983dec062d7 100644
--- a/drivers/hid/hid-roccat-isku.c
+++ b/drivers/hid/hid-roccat-isku.c
@@ -109,13 +109,14 @@ static ssize_t isku_sysfs_set_actual_profile(struct device *dev,
109 109
110 return size; 110 return size;
111} 111}
112static DEVICE_ATTR(actual_profile, 0660, isku_sysfs_show_actual_profile,
113 isku_sysfs_set_actual_profile);
112 114
113static struct device_attribute isku_attributes[] = { 115static struct attribute *isku_attrs[] = {
114 __ATTR(actual_profile, 0660, 116 &dev_attr_actual_profile.attr,
115 isku_sysfs_show_actual_profile, 117 NULL,
116 isku_sysfs_set_actual_profile),
117 __ATTR_NULL
118}; 118};
119ATTRIBUTE_GROUPS(isku);
119 120
120static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, 121static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
121 char *buf, loff_t off, size_t count, 122 char *buf, loff_t off, size_t count,
@@ -427,7 +428,7 @@ static int __init isku_init(void)
427 isku_class = class_create(THIS_MODULE, "isku"); 428 isku_class = class_create(THIS_MODULE, "isku");
428 if (IS_ERR(isku_class)) 429 if (IS_ERR(isku_class))
429 return PTR_ERR(isku_class); 430 return PTR_ERR(isku_class);
430 isku_class->dev_attrs = isku_attributes; 431 isku_class->dev_groups = isku_groups;
431 isku_class->dev_bin_attrs = isku_bin_attributes; 432 isku_class->dev_bin_attrs = isku_bin_attributes;
432 433
433 retval = hid_register_driver(&isku_driver); 434 retval = hid_register_driver(&isku_driver);
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 7fae070788fa..d36267339e39 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -386,6 +386,7 @@ static ssize_t kone_sysfs_show_actual_profile(struct device *dev,
386 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 386 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
387 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); 387 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile);
388} 388}
389static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL);
389 390
390static ssize_t kone_sysfs_show_actual_dpi(struct device *dev, 391static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
391 struct device_attribute *attr, char *buf) 392 struct device_attribute *attr, char *buf)
@@ -394,6 +395,7 @@ static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
394 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 395 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
395 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); 396 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi);
396} 397}
398static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL);
397 399
398/* weight is read each time, since we don't get informed when it's changed */ 400/* weight is read each time, since we don't get informed when it's changed */
399static ssize_t kone_sysfs_show_weight(struct device *dev, 401static ssize_t kone_sysfs_show_weight(struct device *dev,
@@ -416,6 +418,7 @@ static ssize_t kone_sysfs_show_weight(struct device *dev,
416 return retval; 418 return retval;
417 return snprintf(buf, PAGE_SIZE, "%d\n", weight); 419 return snprintf(buf, PAGE_SIZE, "%d\n", weight);
418} 420}
421static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL);
419 422
420static ssize_t kone_sysfs_show_firmware_version(struct device *dev, 423static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
421 struct device_attribute *attr, char *buf) 424 struct device_attribute *attr, char *buf)
@@ -424,6 +427,8 @@ static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
424 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 427 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
425 return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); 428 return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version);
426} 429}
430static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version,
431 NULL);
427 432
428static ssize_t kone_sysfs_show_tcu(struct device *dev, 433static ssize_t kone_sysfs_show_tcu(struct device *dev,
429 struct device_attribute *attr, char *buf) 434 struct device_attribute *attr, char *buf)
@@ -524,6 +529,7 @@ exit_unlock:
524 mutex_unlock(&kone->kone_lock); 529 mutex_unlock(&kone->kone_lock);
525 return retval; 530 return retval;
526} 531}
532static DEVICE_ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu);
527 533
528static ssize_t kone_sysfs_show_startup_profile(struct device *dev, 534static ssize_t kone_sysfs_show_startup_profile(struct device *dev,
529 struct device_attribute *attr, char *buf) 535 struct device_attribute *attr, char *buf)
@@ -570,15 +576,17 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
570 mutex_unlock(&kone->kone_lock); 576 mutex_unlock(&kone->kone_lock);
571 return size; 577 return size;
572} 578}
579static DEVICE_ATTR(startup_profile, 0660, kone_sysfs_show_startup_profile,
580 kone_sysfs_set_startup_profile);
573 581
574static struct device_attribute kone_attributes[] = { 582static struct attribute *kone_attrs[] = {
575 /* 583 /*
576 * Read actual dpi settings. 584 * Read actual dpi settings.
577 * Returns raw value for further processing. Refer to enum 585 * Returns raw value for further processing. Refer to enum
578 * kone_polling_rates to get real value. 586 * kone_polling_rates to get real value.
579 */ 587 */
580 __ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL), 588 &dev_attr_actual_dpi.attr,
581 __ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL), 589 &dev_attr_actual_profile.attr,
582 590
583 /* 591 /*
584 * The mouse can be equipped with one of four supplied weights from 5 592 * The mouse can be equipped with one of four supplied weights from 5
@@ -587,7 +595,7 @@ static struct device_attribute kone_attributes[] = {
587 * by software. Refer to enum kone_weights to get corresponding real 595 * by software. Refer to enum kone_weights to get corresponding real
588 * weight. 596 * weight.
589 */ 597 */
590 __ATTR(weight, 0440, kone_sysfs_show_weight, NULL), 598 &dev_attr_weight.attr,
591 599
592 /* 600 /*
593 * Prints firmware version stored in mouse as integer. 601 * Prints firmware version stored in mouse as integer.
@@ -595,22 +603,20 @@ static struct device_attribute kone_attributes[] = {
595 * to get the real version number the decimal point has to be shifted 2 603 * to get the real version number the decimal point has to be shifted 2
596 * positions to the left. E.g. a value of 138 means 1.38. 604 * positions to the left. E.g. a value of 138 means 1.38.
597 */ 605 */
598 __ATTR(firmware_version, 0440, 606 &dev_attr_firmware_version.attr,
599 kone_sysfs_show_firmware_version, NULL),
600 607
601 /* 608 /*
602 * Prints state of Tracking Control Unit as number where 0 = off and 609 * Prints state of Tracking Control Unit as number where 0 = off and
603 * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and 610 * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and
604 * activates the tcu 611 * activates the tcu
605 */ 612 */
606 __ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu), 613 &dev_attr_tcu.attr,
607 614
608 /* Prints and takes the number of the profile the mouse starts with */ 615 /* Prints and takes the number of the profile the mouse starts with */
609 __ATTR(startup_profile, 0660, 616 &dev_attr_startup_profile.attr,
610 kone_sysfs_show_startup_profile, 617 NULL,
611 kone_sysfs_set_startup_profile),
612 __ATTR_NULL
613}; 618};
619ATTRIBUTE_GROUPS(kone);
614 620
615static struct bin_attribute kone_bin_attributes[] = { 621static struct bin_attribute kone_bin_attributes[] = {
616 { 622 {
@@ -891,7 +897,7 @@ static int __init kone_init(void)
891 kone_class = class_create(THIS_MODULE, "kone"); 897 kone_class = class_create(THIS_MODULE, "kone");
892 if (IS_ERR(kone_class)) 898 if (IS_ERR(kone_class))
893 return PTR_ERR(kone_class); 899 return PTR_ERR(kone_class);
894 kone_class->dev_attrs = kone_attributes; 900 kone_class->dev_groups = kone_groups;
895 kone_class->dev_bin_attrs = kone_bin_attributes; 901 kone_class->dev_bin_attrs = kone_bin_attributes;
896 902
897 retval = hid_register_driver(&kone_driver); 903 retval = hid_register_driver(&kone_driver);
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 6a48fa3c7da9..11906b4b42b2 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -274,6 +274,12 @@ static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev,
274 274
275 return size; 275 return size;
276} 276}
277static DEVICE_ATTR(actual_profile, 0660,
278 koneplus_sysfs_show_actual_profile,
279 koneplus_sysfs_set_actual_profile);
280static DEVICE_ATTR(startup_profile, 0660,
281 koneplus_sysfs_show_actual_profile,
282 koneplus_sysfs_set_actual_profile);
277 283
278static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, 284static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
279 struct device_attribute *attr, char *buf) 285 struct device_attribute *attr, char *buf)
@@ -293,18 +299,16 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
293 299
294 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); 300 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
295} 301}
296 302static DEVICE_ATTR(firmware_version, 0440,
297static struct device_attribute koneplus_attributes[] = { 303 koneplus_sysfs_show_firmware_version, NULL);
298 __ATTR(actual_profile, 0660, 304
299 koneplus_sysfs_show_actual_profile, 305static struct attribute *koneplus_attrs[] = {
300 koneplus_sysfs_set_actual_profile), 306 &dev_attr_actual_profile.attr,
301 __ATTR(startup_profile, 0660, 307 &dev_attr_startup_profile.attr,
302 koneplus_sysfs_show_actual_profile, 308 &dev_attr_firmware_version.attr,
303 koneplus_sysfs_set_actual_profile), 309 NULL,
304 __ATTR(firmware_version, 0440,
305 koneplus_sysfs_show_firmware_version, NULL),
306 __ATTR_NULL
307}; 310};
311ATTRIBUTE_GROUPS(koneplus);
308 312
309static struct bin_attribute koneplus_bin_attributes[] = { 313static struct bin_attribute koneplus_bin_attributes[] = {
310 KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL), 314 KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -572,7 +576,7 @@ static int __init koneplus_init(void)
572 koneplus_class = class_create(THIS_MODULE, "koneplus"); 576 koneplus_class = class_create(THIS_MODULE, "koneplus");
573 if (IS_ERR(koneplus_class)) 577 if (IS_ERR(koneplus_class))
574 return PTR_ERR(koneplus_class); 578 return PTR_ERR(koneplus_class);
575 koneplus_class->dev_attrs = koneplus_attributes; 579 koneplus_class->dev_groups = koneplus_groups;
576 koneplus_class->dev_bin_attrs = koneplus_bin_attributes; 580 koneplus_class->dev_bin_attrs = koneplus_bin_attributes;
577 581
578 retval = hid_register_driver(&koneplus_driver); 582 retval = hid_register_driver(&koneplus_driver);
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
index b8b37789b864..ae630221f896 100644
--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -310,6 +310,9 @@ static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
310 310
311 return size; 311 return size;
312} 312}
313static DEVICE_ATTR(actual_profile, 0660,
314 kovaplus_sysfs_show_actual_profile,
315 kovaplus_sysfs_set_actual_profile);
313 316
314static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev, 317static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
315 struct device_attribute *attr, char *buf) 318 struct device_attribute *attr, char *buf)
@@ -318,6 +321,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
318 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 321 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
319 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi); 322 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
320} 323}
324static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL);
321 325
322static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev, 326static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
323 struct device_attribute *attr, char *buf) 327 struct device_attribute *attr, char *buf)
@@ -326,6 +330,8 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
326 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 330 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
327 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity); 331 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
328} 332}
333static DEVICE_ATTR(actual_sensitivity_x, 0440,
334 kovaplus_sysfs_show_actual_sensitivity_x, NULL);
329 335
330static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev, 336static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
331 struct device_attribute *attr, char *buf) 337 struct device_attribute *attr, char *buf)
@@ -334,6 +340,8 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
334 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 340 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
335 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity); 341 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
336} 342}
343static DEVICE_ATTR(actual_sensitivity_y, 0440,
344 kovaplus_sysfs_show_actual_sensitivity_y, NULL);
337 345
338static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev, 346static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
339 struct device_attribute *attr, char *buf) 347 struct device_attribute *attr, char *buf)
@@ -353,21 +361,18 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
353 361
354 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); 362 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
355} 363}
364static DEVICE_ATTR(firmware_version, 0440,
365 kovaplus_sysfs_show_firmware_version, NULL);
356 366
357static struct device_attribute kovaplus_attributes[] = { 367static struct attribute *kovaplus_attrs[] = {
358 __ATTR(actual_cpi, 0440, 368 &dev_attr_actual_cpi.attr,
359 kovaplus_sysfs_show_actual_cpi, NULL), 369 &dev_attr_firmware_version.attr,
360 __ATTR(firmware_version, 0440, 370 &dev_attr_actual_profile.attr,
361 kovaplus_sysfs_show_firmware_version, NULL), 371 &dev_attr_actual_sensitivity_x.attr,
362 __ATTR(actual_profile, 0660, 372 &dev_attr_actual_sensitivity_y.attr,
363 kovaplus_sysfs_show_actual_profile, 373 NULL,
364 kovaplus_sysfs_set_actual_profile),
365 __ATTR(actual_sensitivity_x, 0440,
366 kovaplus_sysfs_show_actual_sensitivity_x, NULL),
367 __ATTR(actual_sensitivity_y, 0440,
368 kovaplus_sysfs_show_actual_sensitivity_y, NULL),
369 __ATTR_NULL
370}; 374};
375ATTRIBUTE_GROUPS(kovaplus);
371 376
372static struct bin_attribute kovaplus_bin_attributes[] = { 377static struct bin_attribute kovaplus_bin_attributes[] = {
373 KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL), 378 KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -662,7 +667,7 @@ static int __init kovaplus_init(void)
662 kovaplus_class = class_create(THIS_MODULE, "kovaplus"); 667 kovaplus_class = class_create(THIS_MODULE, "kovaplus");
663 if (IS_ERR(kovaplus_class)) 668 if (IS_ERR(kovaplus_class))
664 return PTR_ERR(kovaplus_class); 669 return PTR_ERR(kovaplus_class);
665 kovaplus_class->dev_attrs = kovaplus_attributes; 670 kovaplus_class->dev_groups = kovaplus_groups;
666 kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes; 671 kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes;
667 672
668 retval = hid_register_driver(&kovaplus_driver); 673 retval = hid_register_driver(&kovaplus_driver);
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index d4f1e3bee590..7960d507ad9a 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -266,6 +266,7 @@ static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev,
266 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 266 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
267 return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); 267 return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi);
268} 268}
269static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL);
269 270
270static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, 271static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
271 struct device_attribute *attr, char *buf) 272 struct device_attribute *attr, char *buf)
@@ -282,6 +283,8 @@ static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
282 283
283 return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); 284 return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile);
284} 285}
286static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
287static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
285 288
286static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, 289static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
287 struct device_attribute *attr, char *buf) 290 struct device_attribute *attr, char *buf)
@@ -301,16 +304,17 @@ static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
301 304
302 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); 305 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
303} 306}
304 307static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version,
305static struct device_attribute pyra_attributes[] = { 308 NULL);
306 __ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL), 309
307 __ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL), 310static struct attribute *pyra_attrs[] = {
308 __ATTR(firmware_version, 0440, 311 &dev_attr_actual_cpi.attr,
309 pyra_sysfs_show_firmware_version, NULL), 312 &dev_attr_actual_profile.attr,
310 __ATTR(startup_profile, 0440, 313 &dev_attr_firmware_version.attr,
311 pyra_sysfs_show_actual_profile, NULL), 314 &dev_attr_startup_profile.attr,
312 __ATTR_NULL 315 NULL,
313}; 316};
317ATTRIBUTE_GROUPS(pyra);
314 318
315static struct bin_attribute pyra_bin_attributes[] = { 319static struct bin_attribute pyra_bin_attributes[] = {
316 PYRA_BIN_ATTRIBUTE_W(control, CONTROL), 320 PYRA_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -600,7 +604,7 @@ static int __init pyra_init(void)
600 pyra_class = class_create(THIS_MODULE, "pyra"); 604 pyra_class = class_create(THIS_MODULE, "pyra");
601 if (IS_ERR(pyra_class)) 605 if (IS_ERR(pyra_class))
602 return PTR_ERR(pyra_class); 606 return PTR_ERR(pyra_class);
603 pyra_class->dev_attrs = pyra_attributes; 607 pyra_class->dev_groups = pyra_groups;
604 pyra_class->dev_bin_attrs = pyra_bin_attributes; 608 pyra_class->dev_bin_attrs = pyra_bin_attributes;
605 609
606 retval = hid_register_driver(&pyra_driver); 610 retval = hid_register_driver(&pyra_driver);