aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-01-05 06:48:09 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:48 -0500
commit0933e2d98d1b170ef62d48e18157f5dc43b58217 (patch)
treeecbd589b7607cda35743faf65c8f4326fc8373dd /drivers/staging
parent869dfc875e32fd832385fd52ce54525a10401ed6 (diff)
driver core: Convert some drivers to CLASS_ATTR_STRING
Convert some drivers who export a single string as class attribute to the new class_attr_string functions. This removes redundant code all over. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/asus_oled/asus_oled.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index 7d93f50a0a6..7ebecc92c61 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -770,15 +770,8 @@ static struct usb_driver oled_driver = {
770 .id_table = id_table, 770 .id_table = id_table,
771}; 771};
772 772
773static ssize_t version_show(struct class *dev, 773static CLASS_ATTR_STRING(version, S_IRUGO,
774 struct class_attribute *attr, 774 ASUS_OLED_UNDERSCORE_NAME " " ASUS_OLED_VERSION);
775 char *buf)
776{
777 return sprintf(buf, ASUS_OLED_UNDERSCORE_NAME " %s\n",
778 ASUS_OLED_VERSION);
779}
780
781static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
782 775
783static int __init asus_oled_init(void) 776static int __init asus_oled_init(void)
784{ 777{
@@ -790,7 +783,7 @@ static int __init asus_oled_init(void)
790 return PTR_ERR(oled_class); 783 return PTR_ERR(oled_class);
791 } 784 }
792 785
793 retval = class_create_file(oled_class, &class_attr_version); 786 retval = class_create_file(oled_class, &class_attr_version.attr);
794 if (retval) { 787 if (retval) {
795 err("Error creating class version file"); 788 err("Error creating class version file");
796 goto error; 789 goto error;
@@ -812,7 +805,7 @@ error:
812 805
813static void __exit asus_oled_exit(void) 806static void __exit asus_oled_exit(void)
814{ 807{
815 class_remove_file(oled_class, &class_attr_version); 808 class_remove_file(oled_class, &class_attr_version.attr);
816 class_destroy(oled_class); 809 class_destroy(oled_class);
817 810
818 usb_deregister(&oled_driver); 811 usb_deregister(&oled_driver);