From: Henrique de Moraes Holschuh Date: Fri, 8 Dec 2006 10:40:49 +0000 (-0800) Subject: [PATCH] backlight: do not power off backlight when unregistering X-Git-Tag: v2.6.20-rc1~34^2~66 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=4437cd1e98409e236a9d303fb742fdd53b3a20bb;p=linux-2.6-omap-h63xx.git [PATCH] backlight: do not power off backlight when unregistering ACPI drivers like ibm-acpi are moving to the backlight sysfs infrastructure. During ibm-acpi testing, I have noticed that backlight_device_unregister() sets the display brightness and power to zero. This causes the display to be dimmed on ibm-acpi module removal. It will affect all other ACPI drivers that are being converted to use the backlight class, as well. It also affects a number of framebuffer devices that are used on desktops and laptops which might also not want such behaviour. Since working around this behaviour requires undesireable hacks, Richard Purdie decided that we would be better off reverting the changes in the sysfs class, and adding the code to dim and power off the backlight device to the drivers that want it. This patch is my attempt to do so. Patch against latest linux-2.6.git. Changes untested, as I lack the required hardware. Still, they are trivial enough that, apart from typos, there is little chance of getting them wrong. Signed-off-by: Henrique de Moraes Holschuh Acked-by: Richard Purdie Acked-by: Pavel Machek Acked-by: James Simmons Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 1dac9e74342..db8c191b120 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -282,12 +282,6 @@ void backlight_device_unregister(struct backlight_device *bd) &bl_class_device_attributes[i]); down(&bd->sem); - if (likely(bd->props && bd->props->update_status)) { - bd->props->brightness = 0; - bd->props->power = 0; - bd->props->update_status(bd); - } - bd->props = NULL; up(&bd->sem); diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index d07ecb53c68..61587ca2cdb 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c @@ -135,6 +135,10 @@ static int corgibl_probe(struct platform_device *pdev) static int corgibl_remove(struct platform_device *dev) { + corgibl_data.power = 0; + corgibl_data.brightness = 0; + corgibl_send_intensity(corgi_backlight_device); + backlight_device_unregister(corgi_backlight_device); printk("Corgi Backlight Driver Unloaded\n"); diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index e3993213d10..1c569fb543a 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -117,6 +117,10 @@ static int __init hp680bl_probe(struct platform_device *dev) static int hp680bl_remove(struct platform_device *dev) { + hp680bl_data.brightness = 0; + hp680bl_data.power = 0; + hp680bl_send_intensity(hp680_backlight_device); + backlight_device_unregister(hp680_backlight_device); return 0; diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index 628571c63ba..2d7905410b2 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -200,6 +200,10 @@ static int locomolcd_remove(struct locomo_dev *dev) { unsigned long flags; + locomobl_data.brightness = 0; + locomobl_data.power = 0; + locomolcd_set_intensity(locomolcd_bl_device); + backlight_device_unregister(locomolcd_bl_device); local_irq_save(flags); locomolcd_dev = NULL;