mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]>
This commit is contained in:
parent
e0e34ef7f0
commit
321709c599
8 changed files with 34 additions and 101 deletions
|
|
@ -1829,13 +1829,6 @@ static void aty128_bl_init(struct aty128fb_par *par)
|
|||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
backlight_update_status(bd);
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (!pmac_backlight)
|
||||
pmac_backlight = bd;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
|
||||
printk("aty128: Backlight initialized (%s)\n", name);
|
||||
|
||||
return;
|
||||
|
|
@ -1846,17 +1839,8 @@ error:
|
|||
|
||||
static void aty128_bl_exit(struct backlight_device *bd)
|
||||
{
|
||||
if (bd) {
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (pmac_backlight == bd)
|
||||
pmac_backlight = NULL;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
backlight_device_unregister(bd);
|
||||
|
||||
printk("aty128: Backlight unloaded\n");
|
||||
}
|
||||
backlight_device_unregister(bd);
|
||||
printk("aty128: Backlight unloaded\n");
|
||||
}
|
||||
#endif /* CONFIG_FB_ATY128_BACKLIGHT */
|
||||
|
||||
|
|
|
|||
|
|
@ -2198,13 +2198,6 @@ static void aty_bl_init(struct atyfb_par *par)
|
|||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
backlight_update_status(bd);
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (!pmac_backlight)
|
||||
pmac_backlight = bd;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
|
||||
printk("aty: Backlight initialized (%s)\n", name);
|
||||
|
||||
return;
|
||||
|
|
@ -2215,17 +2208,8 @@ error:
|
|||
|
||||
static void aty_bl_exit(struct backlight_device *bd)
|
||||
{
|
||||
if (bd) {
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (pmac_backlight == bd)
|
||||
pmac_backlight = NULL;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
backlight_device_unregister(bd);
|
||||
|
||||
printk("aty: Backlight unloaded\n");
|
||||
}
|
||||
backlight_device_unregister(bd);
|
||||
printk("aty: Backlight unloaded\n");
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FB_ATY_BACKLIGHT */
|
||||
|
|
|
|||
|
|
@ -192,13 +192,6 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
|
|||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
backlight_update_status(bd);
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (!pmac_backlight)
|
||||
pmac_backlight = bd;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
|
||||
printk("radeonfb: Backlight initialized (%s)\n", name);
|
||||
|
||||
return;
|
||||
|
|
@ -215,12 +208,6 @@ void radeonfb_bl_exit(struct radeonfb_info *rinfo)
|
|||
if (bd) {
|
||||
struct radeon_bl_privdata *pdata;
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (pmac_backlight == bd)
|
||||
pmac_backlight = NULL;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
pdata = class_get_devdata(&bd->class_dev);
|
||||
backlight_device_unregister(bd);
|
||||
kfree(pdata);
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
#include "nv_type.h"
|
||||
#include "nv_proto.h"
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
#include <asm/backlight.h>
|
||||
#include <asm/machdep.h>
|
||||
#endif
|
||||
|
||||
/* We do not have any information about which values are allowed, thus
|
||||
* we used safe values.
|
||||
*/
|
||||
|
|
@ -128,13 +123,6 @@ void nvidia_bl_init(struct nvidia_par *par)
|
|||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
backlight_update_status(bd);
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (!pmac_backlight)
|
||||
pmac_backlight = bd;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
|
||||
printk("nvidia: Backlight initialized (%s)\n", name);
|
||||
|
||||
return;
|
||||
|
|
@ -148,15 +136,6 @@ void nvidia_bl_exit(struct nvidia_par *par)
|
|||
struct fb_info *info = pci_get_drvdata(par->pci_dev);
|
||||
struct backlight_device *bd = info->bl_dev;
|
||||
|
||||
if (bd) {
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (pmac_backlight == bd)
|
||||
pmac_backlight = NULL;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
backlight_device_unregister(bd);
|
||||
|
||||
printk("nvidia: Backlight unloaded\n");
|
||||
}
|
||||
backlight_device_unregister(bd);
|
||||
printk("nvidia: Backlight unloaded\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,13 +371,6 @@ static void riva_bl_init(struct riva_par *par)
|
|||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
backlight_update_status(bd);
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (!pmac_backlight)
|
||||
pmac_backlight = bd;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
|
||||
printk("riva: Backlight initialized (%s)\n", name);
|
||||
|
||||
return;
|
||||
|
|
@ -390,17 +383,8 @@ static void riva_bl_exit(struct fb_info *info)
|
|||
{
|
||||
struct backlight_device *bd = info->bl_dev;
|
||||
|
||||
if (bd) {
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
mutex_lock(&pmac_backlight_mutex);
|
||||
if (pmac_backlight == bd)
|
||||
pmac_backlight = NULL;
|
||||
mutex_unlock(&pmac_backlight_mutex);
|
||||
#endif
|
||||
backlight_device_unregister(bd);
|
||||
|
||||
printk("riva: Backlight unloaded\n");
|
||||
}
|
||||
backlight_device_unregister(bd);
|
||||
printk("riva: Backlight unloaded\n");
|
||||
}
|
||||
#else
|
||||
static inline void riva_bl_init(struct riva_par *par) {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue