提交 a9303638 编写于 作者: B Benjamin Herrenschmidt 提交者: Linus Torvalds

[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: NMichael Hanselmann <linux-kernel@hansmi.ch>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 4cfb04a9
...@@ -167,11 +167,11 @@ void __init pmu_backlight_init() ...@@ -167,11 +167,11 @@ void __init pmu_backlight_init()
pmu_backlight_data.max_brightness / 15); pmu_backlight_data.max_brightness / 15);
} }
up(&bd->sem); down(&bd->sem);
bd->props->brightness = level; bd->props->brightness = level;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
if (!pmac_backlight) if (!pmac_backlight)
......
...@@ -1800,14 +1800,15 @@ static struct backlight_properties aty128_bl_data = { ...@@ -1800,14 +1800,15 @@ static struct backlight_properties aty128_bl_data = {
static void aty128_bl_set_power(struct fb_info *info, int power) static void aty128_bl_set_power(struct fb_info *info, int power)
{ {
if (info->bl_dev == NULL)
return;
mutex_lock(&info->bl_mutex); mutex_lock(&info->bl_mutex);
up(&info->bl_dev->sem);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power; info->bl_dev->props->power = power;
__aty128_bl_update_status(info->bl_dev); __aty128_bl_update_status(info->bl_dev);
down(&info->bl_dev->sem); up(&info->bl_dev->sem);
}
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
} }
...@@ -1842,11 +1843,11 @@ static void aty128_bl_init(struct aty128fb_par *par) ...@@ -1842,11 +1843,11 @@ static void aty128_bl_init(struct aty128fb_par *par)
219 * FB_BACKLIGHT_MAX / MAX_LEVEL); 219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
up(&bd->sem); down(&bd->sem);
bd->props->brightness = aty128_bl_data.max_brightness; bd->props->brightness = aty128_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
......
...@@ -2199,14 +2199,15 @@ static struct backlight_properties aty_bl_data = { ...@@ -2199,14 +2199,15 @@ static struct backlight_properties aty_bl_data = {
static void aty_bl_set_power(struct fb_info *info, int power) static void aty_bl_set_power(struct fb_info *info, int power)
{ {
if (info->bl_dev == NULL)
return;
mutex_lock(&info->bl_mutex); mutex_lock(&info->bl_mutex);
up(&info->bl_dev->sem);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power; info->bl_dev->props->power = power;
__aty_bl_update_status(info->bl_dev); __aty_bl_update_status(info->bl_dev);
down(&info->bl_dev->sem); up(&info->bl_dev->sem);
}
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
} }
...@@ -2237,11 +2238,11 @@ static void aty_bl_init(struct atyfb_par *par) ...@@ -2237,11 +2238,11 @@ static void aty_bl_init(struct atyfb_par *par)
0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
up(&bd->sem); down(&bd->sem);
bd->props->brightness = aty_bl_data.max_brightness; bd->props->brightness = aty_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
......
...@@ -195,11 +195,11 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) ...@@ -195,11 +195,11 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
mutex_unlock(&rinfo->info->bl_mutex); mutex_unlock(&rinfo->info->bl_mutex);
up(&bd->sem); down(&bd->sem);
bd->props->brightness = radeon_bl_data.max_brightness; bd->props->brightness = radeon_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
......
...@@ -112,13 +112,15 @@ static struct backlight_properties nvidia_bl_data = { ...@@ -112,13 +112,15 @@ static struct backlight_properties nvidia_bl_data = {
void nvidia_bl_set_power(struct fb_info *info, int power) void nvidia_bl_set_power(struct fb_info *info, int power)
{ {
if (info->bl_dev == NULL)
return;
mutex_lock(&info->bl_mutex); mutex_lock(&info->bl_mutex);
up(&info->bl_dev->sem);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power; info->bl_dev->props->power = power;
__nvidia_bl_update_status(info->bl_dev); __nvidia_bl_update_status(info->bl_dev);
down(&info->bl_dev->sem); up(&info->bl_dev->sem);
}
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
} }
...@@ -153,11 +155,11 @@ void nvidia_bl_init(struct nvidia_par *par) ...@@ -153,11 +155,11 @@ void nvidia_bl_init(struct nvidia_par *par)
0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
up(&bd->sem); down(&bd->sem);
bd->props->brightness = nvidia_bl_data.max_brightness; bd->props->brightness = nvidia_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
......
...@@ -354,14 +354,15 @@ static struct backlight_properties riva_bl_data = { ...@@ -354,14 +354,15 @@ static struct backlight_properties riva_bl_data = {
static void riva_bl_set_power(struct fb_info *info, int power) static void riva_bl_set_power(struct fb_info *info, int power)
{ {
if (info->bl_dev == NULL)
return;
mutex_lock(&info->bl_mutex); mutex_lock(&info->bl_mutex);
up(&info->bl_dev->sem);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power; info->bl_dev->props->power = power;
__riva_bl_update_status(info->bl_dev); __riva_bl_update_status(info->bl_dev);
down(&info->bl_dev->sem); up(&info->bl_dev->sem);
}
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
} }
...@@ -396,11 +397,11 @@ static void riva_bl_init(struct riva_par *par) ...@@ -396,11 +397,11 @@ static void riva_bl_init(struct riva_par *par)
0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex); mutex_unlock(&info->bl_mutex);
up(&bd->sem); down(&bd->sem);
bd->props->brightness = riva_bl_data.max_brightness; bd->props->brightness = riva_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK; bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd); bd->props->update_status(bd);
down(&bd->sem); up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex); mutex_lock(&pmac_backlight_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册