diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-25 19:34:40 -0400 |
commit | ea1bb7064fd6972ef00a93ba882a2f38450b273e (patch) | |
tree | b165c2f90c0d654119a6bc5e7f01eedfee523f72 /drivers/video/backlight/backlight.c | |
parent | 92a3e661bf55457091817c5c346c4313be2508af (diff) |
video: backlight: 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 video backlight class code to
use the correct field.
Cc: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 3fccb6d3c8c3..94a403a9717a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -103,16 +103,16 @@ static void backlight_generate_event(struct backlight_device *bd, | |||
103 | sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); | 103 | sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); |
104 | } | 104 | } |
105 | 105 | ||
106 | static ssize_t backlight_show_power(struct device *dev, | 106 | static ssize_t bl_power_show(struct device *dev, struct device_attribute *attr, |
107 | struct device_attribute *attr, char *buf) | 107 | char *buf) |
108 | { | 108 | { |
109 | struct backlight_device *bd = to_backlight_device(dev); | 109 | struct backlight_device *bd = to_backlight_device(dev); |
110 | 110 | ||
111 | return sprintf(buf, "%d\n", bd->props.power); | 111 | return sprintf(buf, "%d\n", bd->props.power); |
112 | } | 112 | } |
113 | 113 | ||
114 | static ssize_t backlight_store_power(struct device *dev, | 114 | static ssize_t bl_power_store(struct device *dev, struct device_attribute *attr, |
115 | struct device_attribute *attr, const char *buf, size_t count) | 115 | const char *buf, size_t count) |
116 | { | 116 | { |
117 | int rc; | 117 | int rc; |
118 | struct backlight_device *bd = to_backlight_device(dev); | 118 | struct backlight_device *bd = to_backlight_device(dev); |
@@ -136,8 +136,9 @@ static ssize_t backlight_store_power(struct device *dev, | |||
136 | 136 | ||
137 | return rc; | 137 | return rc; |
138 | } | 138 | } |
139 | static DEVICE_ATTR_RW(bl_power); | ||
139 | 140 | ||
140 | static ssize_t backlight_show_brightness(struct device *dev, | 141 | static ssize_t brightness_show(struct device *dev, |
141 | struct device_attribute *attr, char *buf) | 142 | struct device_attribute *attr, char *buf) |
142 | { | 143 | { |
143 | struct backlight_device *bd = to_backlight_device(dev); | 144 | struct backlight_device *bd = to_backlight_device(dev); |
@@ -145,7 +146,7 @@ static ssize_t backlight_show_brightness(struct device *dev, | |||
145 | return sprintf(buf, "%d\n", bd->props.brightness); | 146 | return sprintf(buf, "%d\n", bd->props.brightness); |
146 | } | 147 | } |
147 | 148 | ||
148 | static ssize_t backlight_store_brightness(struct device *dev, | 149 | static ssize_t brightness_store(struct device *dev, |
149 | struct device_attribute *attr, const char *buf, size_t count) | 150 | struct device_attribute *attr, const char *buf, size_t count) |
150 | { | 151 | { |
151 | int rc; | 152 | int rc; |
@@ -175,24 +176,27 @@ static ssize_t backlight_store_brightness(struct device *dev, | |||
175 | 176 | ||
176 | return rc; | 177 | return rc; |
177 | } | 178 | } |
179 | static DEVICE_ATTR_RW(brightness); | ||
178 | 180 | ||
179 | static ssize_t backlight_show_type(struct device *dev, | 181 | static ssize_t type_show(struct device *dev, struct device_attribute *attr, |
180 | struct device_attribute *attr, char *buf) | 182 | char *buf) |
181 | { | 183 | { |
182 | struct backlight_device *bd = to_backlight_device(dev); | 184 | struct backlight_device *bd = to_backlight_device(dev); |
183 | 185 | ||
184 | return sprintf(buf, "%s\n", backlight_types[bd->props.type]); | 186 | return sprintf(buf, "%s\n", backlight_types[bd->props.type]); |
185 | } | 187 | } |
188 | static DEVICE_ATTR_RO(type); | ||
186 | 189 | ||
187 | static ssize_t backlight_show_max_brightness(struct device *dev, | 190 | static ssize_t max_brightness_show(struct device *dev, |
188 | struct device_attribute *attr, char *buf) | 191 | struct device_attribute *attr, char *buf) |
189 | { | 192 | { |
190 | struct backlight_device *bd = to_backlight_device(dev); | 193 | struct backlight_device *bd = to_backlight_device(dev); |
191 | 194 | ||
192 | return sprintf(buf, "%d\n", bd->props.max_brightness); | 195 | return sprintf(buf, "%d\n", bd->props.max_brightness); |
193 | } | 196 | } |
197 | static DEVICE_ATTR_RO(max_brightness); | ||
194 | 198 | ||
195 | static ssize_t backlight_show_actual_brightness(struct device *dev, | 199 | static ssize_t actual_brightness_show(struct device *dev, |
196 | struct device_attribute *attr, char *buf) | 200 | struct device_attribute *attr, char *buf) |
197 | { | 201 | { |
198 | int rc = -ENXIO; | 202 | int rc = -ENXIO; |
@@ -205,6 +209,7 @@ static ssize_t backlight_show_actual_brightness(struct device *dev, | |||
205 | 209 | ||
206 | return rc; | 210 | return rc; |
207 | } | 211 | } |
212 | static DEVICE_ATTR_RO(actual_brightness); | ||
208 | 213 | ||
209 | static struct class *backlight_class; | 214 | static struct class *backlight_class; |
210 | 215 | ||
@@ -247,16 +252,15 @@ static void bl_device_release(struct device *dev) | |||
247 | kfree(bd); | 252 | kfree(bd); |
248 | } | 253 | } |
249 | 254 | ||
250 | static struct device_attribute bl_device_attributes[] = { | 255 | static struct attribute *bl_device_attrs[] = { |
251 | __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), | 256 | &dev_attr_bl_power.attr, |
252 | __ATTR(brightness, 0644, backlight_show_brightness, | 257 | &dev_attr_brightness.attr, |
253 | backlight_store_brightness), | 258 | &dev_attr_actual_brightness.attr, |
254 | __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, | 259 | &dev_attr_max_brightness.attr, |
255 | NULL), | 260 | &dev_attr_type.attr, |
256 | __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), | 261 | NULL, |
257 | __ATTR(type, 0444, backlight_show_type, NULL), | ||
258 | __ATTR_NULL, | ||
259 | }; | 262 | }; |
263 | ATTRIBUTE_GROUPS(bl_device); | ||
260 | 264 | ||
261 | /** | 265 | /** |
262 | * backlight_force_update - tell the backlight subsystem that hardware state | 266 | * backlight_force_update - tell the backlight subsystem that hardware state |
@@ -493,7 +497,7 @@ static int __init backlight_class_init(void) | |||
493 | return PTR_ERR(backlight_class); | 497 | return PTR_ERR(backlight_class); |
494 | } | 498 | } |
495 | 499 | ||
496 | backlight_class->dev_attrs = bl_device_attributes; | 500 | backlight_class->dev_groups = bl_device_groups; |
497 | backlight_class->pm = &backlight_class_dev_pm_ops; | 501 | backlight_class->pm = &backlight_class_dev_pm_ops; |
498 | return 0; | 502 | return 0; |
499 | } | 503 | } |