[PATCH] backlight: l4f00242t03: Prevent unbalanced calls toregulator enable/disable

From: Alberto Panizzo
Date: Mon Nov 29 2010 - 10:36:23 EST


Otherwise a double call to:
$ echo 4 > /sys/class/lcd/l4f00242t03/lcd_power
Will, the first power down the lcd and regulators correctly and the
second produce an unbalanced call to regulator disable.

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@xxxxxxxxx>
---

This patch follow the one this mail is answering.
Thanks for reviewing.

Best regards,
Alberto!

drivers/video/backlight/l4f00242t03.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index c04aa90..98ad3e5 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -136,10 +136,12 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power)
}
} else {
/* power == FB_BLANK_POWERDOWN */
- /* Clear the screen before shutting down */
- spi_write(spi, (const u8 *)&disoff, sizeof(u16));
- msleep(60);
- l4f00242t03_lcd_powerdown(spi);
+ if (priv->lcd_state != FB_BLANK_POWERDOWN) {
+ /* Clear the screen before shutting down */
+ spi_write(spi, (const u8 *)&disoff, sizeof(u16));
+ msleep(60);
+ l4f00242t03_lcd_powerdown(spi);
+ }
}

priv->lcd_state = power;
--
1.6.3.3



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/