From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>,
"Milo(Woogyom) Kim" <milo.kim@ti.com>,
Richard Purdie <rpurdie@rpsys.net>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Subject: [PATCH] leds: lm3530: fix handling of already enabled regulators
Date: Sun, 22 Apr 2012 23:11:48 +0800 [thread overview]
Message-ID: <1335107508.6261.3.camel@phoenix> (raw)
It is possible that the regulator has been previously enabled by bootloader or
kernel board initialization code. Thus, don't assume the regulator is disabled
by default. Get the correct status by regulator_is_enabled().
The leds-lm3530 driver was ignoring the initial status of the
regulator; this resulted in rdev->use_count being incremented to 2 after
calling lm3530_init_registers() in the .probe method when a regulator
was already enabled at insmod time, which made it impossible to ever
disable the regulator.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/leds/leds-lm3530.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index 968fd5f..859bf04 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -397,7 +397,6 @@ static int __devinit lm3530_probe(struct i2c_client *client,
drvdata->client = client;
drvdata->pdata = pdata;
drvdata->brightness = LED_OFF;
- drvdata->enable = false;
drvdata->led_dev.name = LM3530_LED_DEV;
drvdata->led_dev.brightness_set = lm3530_brightness_set;
drvdata->led_dev.max_brightness = MAX_BRIGHTNESS;
@@ -411,6 +410,7 @@ static int __devinit lm3530_probe(struct i2c_client *client,
drvdata->regulator = NULL;
goto err_regulator_get;
}
+ drvdata->enable = regulator_is_enabled(drvdata->regulator);
if (drvdata->pdata->brt_val) {
err = lm3530_init_registers(drvdata);
--
1.7.5.4
next reply other threads:[~2012-04-22 15:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-22 15:11 Axel Lin [this message]
2012-04-23 11:09 ` [PATCH] leds: lm3530: fix handling of already enabled regulators Mark Brown
2012-04-24 2:09 ` Axel Lin
2012-04-24 6:27 ` Kim, Milo
2012-04-24 8:48 ` Axel Lin
2012-04-24 10:15 ` Kim, Milo
2012-04-24 12:35 ` Axel Lin
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=1335107508.6261.3.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=milo.kim@ti.com \
--cc=rpurdie@rpsys.net \
--cc=shreshthakumar.sahu@stericsson.com \
/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