aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/phantom.c
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/misc/phantom.c
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/misc/phantom.c')
-rw-r--r--drivers/misc/phantom.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index d30ae9560309..779aa8ebe4cf 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -497,12 +497,7 @@ static struct pci_driver phantom_pci_driver = {
497 .resume = phantom_resume 497 .resume = phantom_resume
498}; 498};
499 499
500static ssize_t phantom_show_version(struct class *cls, struct class_attribute *attr, char *buf) 500static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);
501{
502 return sprintf(buf, PHANTOM_VERSION "\n");
503}
504
505static CLASS_ATTR(version, 0444, phantom_show_version, NULL);
506 501
507static int __init phantom_init(void) 502static int __init phantom_init(void)
508{ 503{
@@ -515,7 +510,7 @@ static int __init phantom_init(void)
515 printk(KERN_ERR "phantom: can't register phantom class\n"); 510 printk(KERN_ERR "phantom: can't register phantom class\n");
516 goto err; 511 goto err;
517 } 512 }
518 retval = class_create_file(phantom_class, &class_attr_version); 513 retval = class_create_file(phantom_class, &class_attr_version.attr);
519 if (retval) { 514 if (retval) {
520 printk(KERN_ERR "phantom: can't create sysfs version file\n"); 515 printk(KERN_ERR "phantom: can't create sysfs version file\n");
521 goto err_class; 516 goto err_class;
@@ -541,7 +536,7 @@ static int __init phantom_init(void)
541err_unchr: 536err_unchr:
542 unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); 537 unregister_chrdev_region(dev, PHANTOM_MAX_MINORS);
543err_attr: 538err_attr:
544 class_remove_file(phantom_class, &class_attr_version); 539 class_remove_file(phantom_class, &class_attr_version.attr);
545err_class: 540err_class:
546 class_destroy(phantom_class); 541 class_destroy(phantom_class);
547err: 542err:
@@ -554,7 +549,7 @@ static void __exit phantom_exit(void)
554 549
555 unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS); 550 unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS);
556 551
557 class_remove_file(phantom_class, &class_attr_version); 552 class_remove_file(phantom_class, &class_attr_version.attr);
558 class_destroy(phantom_class); 553 class_destroy(phantom_class);
559 554
560 pr_debug("phantom: module successfully removed\n"); 555 pr_debug("phantom: module successfully removed\n");