aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r--drivers/video/backlight/backlight.c44
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
106static ssize_t backlight_show_power(struct device *dev, 106static 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
114static ssize_t backlight_store_power(struct device *dev, 114static 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}
139static DEVICE_ATTR_RW(bl_power);
139 140
140static ssize_t backlight_show_brightness(struct device *dev, 141static 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
148static ssize_t backlight_store_brightness(struct device *dev, 149static 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}
179static DEVICE_ATTR_RW(brightness);
178 180
179static ssize_t backlight_show_type(struct device *dev, 181static 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}
188static DEVICE_ATTR_RO(type);
186 189
187static ssize_t backlight_show_max_brightness(struct device *dev, 190static 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}
197static DEVICE_ATTR_RO(max_brightness);
194 198
195static ssize_t backlight_show_actual_brightness(struct device *dev, 199static 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}
212static DEVICE_ATTR_RO(actual_brightness);
208 213
209static struct class *backlight_class; 214static 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
250static struct device_attribute bl_device_attributes[] = { 255static 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};
263ATTRIBUTE_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}