From 26bbabc8e80b4b9e42aca13376a2c1609a880e21 Mon Sep 17 00:00:00 2001 From: Alberto Panizzo Date: Wed, 12 Jan 2011 16:59:23 -0800 Subject: [PATCH] drivers/video/backlight/l4f00242t03.c: prevent unbalanced calls to regulator enable/disable 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 Cc: Richard Purdie Cc: Marek Vasut Cc: Tejun Heo Cc: Axel Lin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/backlight/l4f00242t03.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 5d25743bf8e2..1fcaaf3d78e1 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c @@ -134,10 +134,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; -- 2.39.5