diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 00:22:34 -0400 |
commit | 46a58c44c173d3cbfa53931fbb7ad069ef59f190 (patch) | |
tree | abccb167ff6c43c04215b7e670513d669afa10b9 /drivers/hid/hid-roccat-kone.c | |
parent | a93d6b0a879718a1a08553935744b0d5c58354c0 (diff) |
HID: roccat: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead. This converts the roccat class code to use the
correct field.
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/hid-roccat-kone.c')
-rw-r--r-- | drivers/hid/hid-roccat-kone.c | 30 |
1 files changed, 18 insertions, 12 deletions
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 | } |
389 | static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL); | ||
389 | 390 | ||
390 | static ssize_t kone_sysfs_show_actual_dpi(struct device *dev, | 391 | static 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 | } |
398 | static 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 */ |
399 | static ssize_t kone_sysfs_show_weight(struct device *dev, | 401 | static 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 | } |
421 | static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL); | ||
419 | 422 | ||
420 | static ssize_t kone_sysfs_show_firmware_version(struct device *dev, | 423 | static 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 | } |
430 | static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version, | ||
431 | NULL); | ||
427 | 432 | ||
428 | static ssize_t kone_sysfs_show_tcu(struct device *dev, | 433 | static 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 | } |
532 | static DEVICE_ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu); | ||
527 | 533 | ||
528 | static ssize_t kone_sysfs_show_startup_profile(struct device *dev, | 534 | static 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 | } |
579 | static DEVICE_ATTR(startup_profile, 0660, kone_sysfs_show_startup_profile, | ||
580 | kone_sysfs_set_startup_profile); | ||
573 | 581 | ||
574 | static struct device_attribute kone_attributes[] = { | 582 | static 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 | }; |
619 | ATTRIBUTE_GROUPS(kone); | ||
614 | 620 | ||
615 | static struct bin_attribute kone_bin_attributes[] = { | 621 | static 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); |