diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-09-01 00:27:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-01 14:39:10 -0400 |
commit | a930363881c225fb52824145d1ba8f1a8c447dd8 (patch) | |
tree | 1e6996560b2cdf9d3978a085bdd1b2ebb4a934a7 | |
parent | 4cfb04a9d3d6865d932d02616b27b89d3a634026 (diff) |
[PATCH] backlight last round of fixes
Fix some more problems (inverted use of semaphores in some places). He
also moved my checks into within the protected section which is better.
Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/macintosh/via-pmu-backlight.c | 4 | ||||
-rw-r--r-- | drivers/video/aty/aty128fb.c | 19 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 19 | ||||
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 4 | ||||
-rw-r--r-- | drivers/video/nvidia/nv_backlight.c | 18 | ||||
-rw-r--r-- | drivers/video/riva/fbdev.c | 19 |
6 files changed, 44 insertions, 39 deletions
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 4397fac55ba0..a82f313d9dc9 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -167,11 +167,11 @@ void __init pmu_backlight_init() | |||
167 | pmu_backlight_data.max_brightness / 15); | 167 | pmu_backlight_data.max_brightness / 15); |
168 | } | 168 | } |
169 | 169 | ||
170 | up(&bd->sem); | 170 | down(&bd->sem); |
171 | bd->props->brightness = level; | 171 | bd->props->brightness = level; |
172 | bd->props->power = FB_BLANK_UNBLANK; | 172 | bd->props->power = FB_BLANK_UNBLANK; |
173 | bd->props->update_status(bd); | 173 | bd->props->update_status(bd); |
174 | down(&bd->sem); | 174 | up(&bd->sem); |
175 | 175 | ||
176 | mutex_lock(&pmac_backlight_mutex); | 176 | mutex_lock(&pmac_backlight_mutex); |
177 | if (!pmac_backlight) | 177 | if (!pmac_backlight) |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 106d428b72c9..276a21530b95 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1800,14 +1800,15 @@ static struct backlight_properties aty128_bl_data = { | |||
1800 | 1800 | ||
1801 | static void aty128_bl_set_power(struct fb_info *info, int power) | 1801 | static void aty128_bl_set_power(struct fb_info *info, int power) |
1802 | { | 1802 | { |
1803 | if (info->bl_dev == NULL) | ||
1804 | return; | ||
1805 | |||
1806 | mutex_lock(&info->bl_mutex); | 1803 | mutex_lock(&info->bl_mutex); |
1807 | up(&info->bl_dev->sem); | 1804 | |
1808 | info->bl_dev->props->power = power; | 1805 | if (info->bl_dev) { |
1809 | __aty128_bl_update_status(info->bl_dev); | 1806 | down(&info->bl_dev->sem); |
1810 | down(&info->bl_dev->sem); | 1807 | info->bl_dev->props->power = power; |
1808 | __aty128_bl_update_status(info->bl_dev); | ||
1809 | up(&info->bl_dev->sem); | ||
1810 | } | ||
1811 | |||
1811 | mutex_unlock(&info->bl_mutex); | 1812 | mutex_unlock(&info->bl_mutex); |
1812 | } | 1813 | } |
1813 | 1814 | ||
@@ -1842,11 +1843,11 @@ static void aty128_bl_init(struct aty128fb_par *par) | |||
1842 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1843 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1843 | mutex_unlock(&info->bl_mutex); | 1844 | mutex_unlock(&info->bl_mutex); |
1844 | 1845 | ||
1845 | up(&bd->sem); | 1846 | down(&bd->sem); |
1846 | bd->props->brightness = aty128_bl_data.max_brightness; | 1847 | bd->props->brightness = aty128_bl_data.max_brightness; |
1847 | bd->props->power = FB_BLANK_UNBLANK; | 1848 | bd->props->power = FB_BLANK_UNBLANK; |
1848 | bd->props->update_status(bd); | 1849 | bd->props->update_status(bd); |
1849 | down(&bd->sem); | 1850 | up(&bd->sem); |
1850 | 1851 | ||
1851 | #ifdef CONFIG_PMAC_BACKLIGHT | 1852 | #ifdef CONFIG_PMAC_BACKLIGHT |
1852 | mutex_lock(&pmac_backlight_mutex); | 1853 | mutex_lock(&pmac_backlight_mutex); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 510e4ea296ed..19a71f045784 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2199,14 +2199,15 @@ static struct backlight_properties aty_bl_data = { | |||
2199 | 2199 | ||
2200 | static void aty_bl_set_power(struct fb_info *info, int power) | 2200 | static void aty_bl_set_power(struct fb_info *info, int power) |
2201 | { | 2201 | { |
2202 | if (info->bl_dev == NULL) | ||
2203 | return; | ||
2204 | |||
2205 | mutex_lock(&info->bl_mutex); | 2202 | mutex_lock(&info->bl_mutex); |
2206 | up(&info->bl_dev->sem); | 2203 | |
2207 | info->bl_dev->props->power = power; | 2204 | if (info->bl_dev) { |
2208 | __aty_bl_update_status(info->bl_dev); | 2205 | down(&info->bl_dev->sem); |
2209 | down(&info->bl_dev->sem); | 2206 | info->bl_dev->props->power = power; |
2207 | __aty_bl_update_status(info->bl_dev); | ||
2208 | up(&info->bl_dev->sem); | ||
2209 | } | ||
2210 | |||
2210 | mutex_unlock(&info->bl_mutex); | 2211 | mutex_unlock(&info->bl_mutex); |
2211 | } | 2212 | } |
2212 | 2213 | ||
@@ -2237,11 +2238,11 @@ static void aty_bl_init(struct atyfb_par *par) | |||
2237 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); | 2238 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); |
2238 | mutex_unlock(&info->bl_mutex); | 2239 | mutex_unlock(&info->bl_mutex); |
2239 | 2240 | ||
2240 | up(&bd->sem); | 2241 | down(&bd->sem); |
2241 | bd->props->brightness = aty_bl_data.max_brightness; | 2242 | bd->props->brightness = aty_bl_data.max_brightness; |
2242 | bd->props->power = FB_BLANK_UNBLANK; | 2243 | bd->props->power = FB_BLANK_UNBLANK; |
2243 | bd->props->update_status(bd); | 2244 | bd->props->update_status(bd); |
2244 | down(&bd->sem); | 2245 | up(&bd->sem); |
2245 | 2246 | ||
2246 | #ifdef CONFIG_PMAC_BACKLIGHT | 2247 | #ifdef CONFIG_PMAC_BACKLIGHT |
2247 | mutex_lock(&pmac_backlight_mutex); | 2248 | mutex_lock(&pmac_backlight_mutex); |
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 1755dddf1899..585eb7b9e636 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -195,11 +195,11 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) | |||
195 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); | 195 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); |
196 | mutex_unlock(&rinfo->info->bl_mutex); | 196 | mutex_unlock(&rinfo->info->bl_mutex); |
197 | 197 | ||
198 | up(&bd->sem); | 198 | down(&bd->sem); |
199 | bd->props->brightness = radeon_bl_data.max_brightness; | 199 | bd->props->brightness = radeon_bl_data.max_brightness; |
200 | bd->props->power = FB_BLANK_UNBLANK; | 200 | bd->props->power = FB_BLANK_UNBLANK; |
201 | bd->props->update_status(bd); | 201 | bd->props->update_status(bd); |
202 | down(&bd->sem); | 202 | up(&bd->sem); |
203 | 203 | ||
204 | #ifdef CONFIG_PMAC_BACKLIGHT | 204 | #ifdef CONFIG_PMAC_BACKLIGHT |
205 | mutex_lock(&pmac_backlight_mutex); | 205 | mutex_lock(&pmac_backlight_mutex); |
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 14c37c42191c..5b75ae4e9457 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c | |||
@@ -112,13 +112,15 @@ static struct backlight_properties nvidia_bl_data = { | |||
112 | 112 | ||
113 | void nvidia_bl_set_power(struct fb_info *info, int power) | 113 | void nvidia_bl_set_power(struct fb_info *info, int power) |
114 | { | 114 | { |
115 | if (info->bl_dev == NULL) | ||
116 | return; | ||
117 | mutex_lock(&info->bl_mutex); | 115 | mutex_lock(&info->bl_mutex); |
118 | up(&info->bl_dev->sem); | 116 | |
119 | info->bl_dev->props->power = power; | 117 | if (info->bl_dev) { |
120 | __nvidia_bl_update_status(info->bl_dev); | 118 | down(&info->bl_dev->sem); |
121 | down(&info->bl_dev->sem); | 119 | info->bl_dev->props->power = power; |
120 | __nvidia_bl_update_status(info->bl_dev); | ||
121 | up(&info->bl_dev->sem); | ||
122 | } | ||
123 | |||
122 | mutex_unlock(&info->bl_mutex); | 124 | mutex_unlock(&info->bl_mutex); |
123 | } | 125 | } |
124 | 126 | ||
@@ -153,11 +155,11 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
153 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 155 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
154 | mutex_unlock(&info->bl_mutex); | 156 | mutex_unlock(&info->bl_mutex); |
155 | 157 | ||
156 | up(&bd->sem); | 158 | down(&bd->sem); |
157 | bd->props->brightness = nvidia_bl_data.max_brightness; | 159 | bd->props->brightness = nvidia_bl_data.max_brightness; |
158 | bd->props->power = FB_BLANK_UNBLANK; | 160 | bd->props->power = FB_BLANK_UNBLANK; |
159 | bd->props->update_status(bd); | 161 | bd->props->update_status(bd); |
160 | down(&bd->sem); | 162 | up(&bd->sem); |
161 | 163 | ||
162 | #ifdef CONFIG_PMAC_BACKLIGHT | 164 | #ifdef CONFIG_PMAC_BACKLIGHT |
163 | mutex_lock(&pmac_backlight_mutex); | 165 | mutex_lock(&pmac_backlight_mutex); |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 90363943bd57..8ddb47a56b07 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -354,14 +354,15 @@ static struct backlight_properties riva_bl_data = { | |||
354 | 354 | ||
355 | static void riva_bl_set_power(struct fb_info *info, int power) | 355 | static void riva_bl_set_power(struct fb_info *info, int power) |
356 | { | 356 | { |
357 | if (info->bl_dev == NULL) | ||
358 | return; | ||
359 | |||
360 | mutex_lock(&info->bl_mutex); | 357 | mutex_lock(&info->bl_mutex); |
361 | up(&info->bl_dev->sem); | 358 | |
362 | info->bl_dev->props->power = power; | 359 | if (info->bl_dev) { |
363 | __riva_bl_update_status(info->bl_dev); | 360 | down(&info->bl_dev->sem); |
364 | down(&info->bl_dev->sem); | 361 | info->bl_dev->props->power = power; |
362 | __riva_bl_update_status(info->bl_dev); | ||
363 | up(&info->bl_dev->sem); | ||
364 | } | ||
365 | |||
365 | mutex_unlock(&info->bl_mutex); | 366 | mutex_unlock(&info->bl_mutex); |
366 | } | 367 | } |
367 | 368 | ||
@@ -396,11 +397,11 @@ static void riva_bl_init(struct riva_par *par) | |||
396 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 397 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
397 | mutex_unlock(&info->bl_mutex); | 398 | mutex_unlock(&info->bl_mutex); |
398 | 399 | ||
399 | up(&bd->sem); | 400 | down(&bd->sem); |
400 | bd->props->brightness = riva_bl_data.max_brightness; | 401 | bd->props->brightness = riva_bl_data.max_brightness; |
401 | bd->props->power = FB_BLANK_UNBLANK; | 402 | bd->props->power = FB_BLANK_UNBLANK; |
402 | bd->props->update_status(bd); | 403 | bd->props->update_status(bd); |
403 | down(&bd->sem); | 404 | up(&bd->sem); |
404 | 405 | ||
405 | #ifdef CONFIG_PMAC_BACKLIGHT | 406 | #ifdef CONFIG_PMAC_BACKLIGHT |
406 | mutex_lock(&pmac_backlight_mutex); | 407 | mutex_lock(&pmac_backlight_mutex); |