aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 10:04:08 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:40 -0500
commit321709c5994f952b78d567fd7083dbebbdc381b7 (patch)
treedf237c216e8bab6ce5c14d5797a796d4bf889a92 /drivers/video/backlight
parente0e34ef7f02915cfe50e501e9f32c24217177a96 (diff)
backlight: Clean up pmac_backlight handling
Move the setting/unsetting of pmac_backlight into the backlight core instead of doing it in each driver. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/backlight.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 5490b2ae5134..822a373d3346 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -14,6 +14,9 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16 16
17#ifdef CONFIG_PMAC_BACKLIGHT
18#include <asm/backlight.h>
19#endif
17 20
18#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 21#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \
19 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) 22 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
@@ -262,6 +265,13 @@ struct backlight_device *backlight_device_register(const char *name,
262 } 265 }
263 } 266 }
264 267
268#ifdef CONFIG_PMAC_BACKLIGHT
269 mutex_lock(&pmac_backlight_mutex);
270 if (!pmac_backlight)
271 pmac_backlight = new_bd;
272 mutex_unlock(&pmac_backlight_mutex);
273#endif
274
265 return new_bd; 275 return new_bd;
266} 276}
267EXPORT_SYMBOL(backlight_device_register); 277EXPORT_SYMBOL(backlight_device_register);
@@ -281,6 +291,13 @@ void backlight_device_unregister(struct backlight_device *bd)
281 291
282 pr_debug("backlight_device_unregister: name=%s\n", bd->class_dev.class_id); 292 pr_debug("backlight_device_unregister: name=%s\n", bd->class_dev.class_id);
283 293
294#ifdef CONFIG_PMAC_BACKLIGHT
295 mutex_lock(&pmac_backlight_mutex);
296 if (pmac_backlight == bd)
297 pmac_backlight = NULL;
298 mutex_unlock(&pmac_backlight_mutex);
299#endif
300
284 for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) 301 for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++)
285 class_device_remove_file(&bd->class_dev, 302 class_device_remove_file(&bd->class_dev,
286 &bl_class_device_attributes[i]); 303 &bl_class_device_attributes[i]);