public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alberto Panizzo <maramaopercheseimorto@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Marek Vasut <marek.vasut@gmail.com>, Tejun Heo <tj@kernel.org>,
	Axel Lin <axel.lin@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] backlight: l4f00242t03: Prevent unbalanced calls to regulator enable/disable
Date: Mon, 29 Nov 2010 16:36:11 +0100	[thread overview]
Message-ID: <1291044971.3139.61.camel@realization> (raw)
In-Reply-To: <1290964433.3016.2.camel@realization>

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>
---

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




  reply	other threads:[~2010-11-29 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28 17:13 [PATCH] backlight: l4f00242t03: Fix reset sequence Alberto Panizzo
2010-11-29 15:36 ` Alberto Panizzo [this message]
2011-01-04 23:59 ` Andrew Morton
2011-01-05  0:32   ` Alberto Panizzo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291044971.3139.61.camel@realization \
    --to=maramaopercheseimorto@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axel.lin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.vasut@gmail.com \
    --cc=rpurdie@rpsys.net \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox