Commit 26bbabc8e80b4b9e42aca13376a2c1609a880e21

Authored by Alberto Panizzo
Committed by Linus Torvalds
1 parent 95558ad15b

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 <maramaopercheseimorto@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 6 additions and 4 deletions Side-by-side Diff

drivers/video/backlight/l4f00242t03.c
... ... @@ -134,10 +134,12 @@
134 134 }
135 135 } else {
136 136 /* power == FB_BLANK_POWERDOWN */
137   - /* Clear the screen before shutting down */
138   - spi_write(spi, (const u8 *)&disoff, sizeof(u16));
139   - msleep(60);
140   - l4f00242t03_lcd_powerdown(spi);
  137 + if (priv->lcd_state != FB_BLANK_POWERDOWN) {
  138 + /* Clear the screen before shutting down */
  139 + spi_write(spi, (const u8 *)&disoff, sizeof(u16));
  140 + msleep(60);
  141 + l4f00242t03_lcd_powerdown(spi);
  142 + }
141 143 }
142 144  
143 145 priv->lcd_state = power;