diff options
Diffstat (limited to 'drivers/video/aty/radeon_backlight.c')
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 9cfcecac8b5e..f94e4616788d 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -29,17 +29,13 @@ struct radeon_bl_privdata { | |||
29 | static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata, | 29 | static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata, |
30 | int level) | 30 | int level) |
31 | { | 31 | { |
32 | struct fb_info *info = pdata->rinfo->info; | ||
33 | int rlevel; | 32 | int rlevel; |
34 | 33 | ||
35 | mutex_lock(&info->bl_mutex); | ||
36 | |||
37 | /* Get and convert the value */ | 34 | /* Get and convert the value */ |
35 | /* No locking of bl_curve since we read a single value */ | ||
38 | rlevel = pdata->rinfo->info->bl_curve[level] * | 36 | rlevel = pdata->rinfo->info->bl_curve[level] * |
39 | FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL; | 37 | FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL; |
40 | 38 | ||
41 | mutex_unlock(&info->bl_mutex); | ||
42 | |||
43 | if (rlevel < 0) | 39 | if (rlevel < 0) |
44 | rlevel = 0; | 40 | rlevel = 0; |
45 | else if (rlevel > MAX_RADEON_LEVEL) | 41 | else if (rlevel > MAX_RADEON_LEVEL) |
@@ -187,12 +183,10 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) | |||
187 | machine_is_compatible("PowerBook6,5"); | 183 | machine_is_compatible("PowerBook6,5"); |
188 | #endif | 184 | #endif |
189 | 185 | ||
190 | mutex_lock(&rinfo->info->bl_mutex); | ||
191 | rinfo->info->bl_dev = bd; | 186 | rinfo->info->bl_dev = bd; |
192 | fb_bl_default_curve(rinfo->info, 0, | 187 | fb_bl_default_curve(rinfo->info, 0, |
193 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, | 188 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, |
194 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); | 189 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); |
195 | mutex_unlock(&rinfo->info->bl_mutex); | ||
196 | 190 | ||
197 | bd->props->brightness = radeon_bl_data.max_brightness; | 191 | bd->props->brightness = radeon_bl_data.max_brightness; |
198 | bd->props->power = FB_BLANK_UNBLANK; | 192 | bd->props->power = FB_BLANK_UNBLANK; |
@@ -216,29 +210,22 @@ error: | |||
216 | 210 | ||
217 | void radeonfb_bl_exit(struct radeonfb_info *rinfo) | 211 | void radeonfb_bl_exit(struct radeonfb_info *rinfo) |
218 | { | 212 | { |
219 | #ifdef CONFIG_PMAC_BACKLIGHT | 213 | struct backlight_device *bd = rinfo->info->bl_dev; |
220 | mutex_lock(&pmac_backlight_mutex); | ||
221 | #endif | ||
222 | 214 | ||
223 | mutex_lock(&rinfo->info->bl_mutex); | 215 | if (bd) { |
224 | if (rinfo->info->bl_dev) { | ||
225 | struct radeon_bl_privdata *pdata; | 216 | struct radeon_bl_privdata *pdata; |
226 | 217 | ||
227 | #ifdef CONFIG_PMAC_BACKLIGHT | 218 | #ifdef CONFIG_PMAC_BACKLIGHT |
228 | if (pmac_backlight == rinfo->info->bl_dev) | 219 | mutex_lock(&pmac_backlight_mutex); |
220 | if (pmac_backlight == bd) | ||
229 | pmac_backlight = NULL; | 221 | pmac_backlight = NULL; |
222 | mutex_unlock(&pmac_backlight_mutex); | ||
230 | #endif | 223 | #endif |
231 | 224 | pdata = class_get_devdata(&bd->class_dev); | |
232 | pdata = class_get_devdata(&rinfo->info->bl_dev->class_dev); | 225 | backlight_device_unregister(bd); |
233 | backlight_device_unregister(rinfo->info->bl_dev); | ||
234 | kfree(pdata); | 226 | kfree(pdata); |
235 | rinfo->info->bl_dev = NULL; | 227 | rinfo->info->bl_dev = NULL; |
236 | 228 | ||
237 | printk("radeonfb: Backlight unloaded\n"); | 229 | printk("radeonfb: Backlight unloaded\n"); |
238 | } | 230 | } |
239 | mutex_unlock(&rinfo->info->bl_mutex); | ||
240 | |||
241 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
242 | mutex_unlock(&pmac_backlight_mutex); | ||
243 | #endif | ||
244 | } | 231 | } |