diff options
author | Andi Kleen <andi@firstfloor.org> | 2010-01-05 06:48:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:48 -0500 |
commit | 0933e2d98d1b170ef62d48e18157f5dc43b58217 (patch) | |
tree | ecbd589b7607cda35743faf65c8f4326fc8373dd /drivers/gpu | |
parent | 869dfc875e32fd832385fd52ce54525a10401ed6 (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/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index b95aaf23596e..014ce24761b9 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -70,20 +70,17 @@ static int drm_class_resume(struct device *dev) | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | /* Display the version of drm_core. This doesn't work right in current design */ | ||
74 | static ssize_t version_show(struct class *dev, struct class_attribute *attr, | ||
75 | char *buf) | ||
76 | { | ||
77 | return sprintf(buf, "%s %d.%d.%d %s\n", CORE_NAME, CORE_MAJOR, | ||
78 | CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); | ||
79 | } | ||
80 | |||
81 | static char *drm_devnode(struct device *dev, mode_t *mode) | 73 | static char *drm_devnode(struct device *dev, mode_t *mode) |
82 | { | 74 | { |
83 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); | 75 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); |
84 | } | 76 | } |
85 | 77 | ||
86 | static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | 78 | static CLASS_ATTR_STRING(version, S_IRUGO, |
79 | CORE_NAME " " | ||
80 | __stringify(CORE_MAJOR) "." | ||
81 | __stringify(CORE_MINOR) "." | ||
82 | __stringify(CORE_PATCHLEVEL) " " | ||
83 | CORE_DATE); | ||
87 | 84 | ||
88 | /** | 85 | /** |
89 | * drm_sysfs_create - create a struct drm_sysfs_class structure | 86 | * drm_sysfs_create - create a struct drm_sysfs_class structure |
@@ -110,7 +107,7 @@ struct class *drm_sysfs_create(struct module *owner, char *name) | |||
110 | class->suspend = drm_class_suspend; | 107 | class->suspend = drm_class_suspend; |
111 | class->resume = drm_class_resume; | 108 | class->resume = drm_class_resume; |
112 | 109 | ||
113 | err = class_create_file(class, &class_attr_version); | 110 | err = class_create_file(class, &class_attr_version.attr); |
114 | if (err) | 111 | if (err) |
115 | goto err_out_class; | 112 | goto err_out_class; |
116 | 113 | ||
@@ -133,7 +130,7 @@ void drm_sysfs_destroy(void) | |||
133 | { | 130 | { |
134 | if ((drm_class == NULL) || (IS_ERR(drm_class))) | 131 | if ((drm_class == NULL) || (IS_ERR(drm_class))) |
135 | return; | 132 | return; |
136 | class_remove_file(drm_class, &class_attr_version); | 133 | class_remove_file(drm_class, &class_attr_version.attr); |
137 | class_destroy(drm_class); | 134 | class_destroy(drm_class); |
138 | } | 135 | } |
139 | 136 | ||