diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-02-10 16:04:08 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-02-20 10:26:40 +0100 |
commit | 321709c5994f952b78d567fd7083dbebbdc381b7 (patch) | |
tree | df237c216e8bab6ce5c14d5797a796d4bf889a92 /drivers/video/backlight/backlight.c | |
parent | backlight: Improve backlight selection for fbdev drivers (diff) | |
download | linux-321709c5994f952b78d567fd7083dbebbdc381b7.tar.xz linux-321709c5994f952b78d567fd7083dbebbdc381b7.zip |
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/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 17 |
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 @@ #include <linux/err.h> #include <linux/fb.h> +#ifdef CONFIG_PMAC_BACKLIGHT +#include <asm/backlight.h> +#endif #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) @@ -262,6 +265,13 @@ struct backlight_device *backlight_device_register(const char *name, } } +#ifdef CONFIG_PMAC_BACKLIGHT + mutex_lock(&pmac_backlight_mutex); + if (!pmac_backlight) + pmac_backlight = new_bd; + mutex_unlock(&pmac_backlight_mutex); +#endif + return new_bd; } EXPORT_SYMBOL(backlight_device_register); @@ -281,6 +291,13 @@ void backlight_device_unregister(struct backlight_device *bd) pr_debug("backlight_device_unregister: name=%s\n", bd->class_dev.class_id); +#ifdef CONFIG_PMAC_BACKLIGHT + mutex_lock(&pmac_backlight_mutex); + if (pmac_backlight == bd) + pmac_backlight = NULL; + mutex_unlock(&pmac_backlight_mutex); +#endif + for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) class_device_remove_file(&bd->class_dev, &bl_class_device_attributes[i]); |