From: Jingoo Han <jg1.han@samsung.com>
To: "'Axel Lin'" <axel.lin@ingics.com>
Cc: "'Mark Brown'" <broonie@kernel.org>,
"'Liam Girdwood'" <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org,
"'Jingoo Han'" <jg1.han@samsung.com>,
"'Sachin Kamat'" <sachin.kamat@linaro.org>
Subject: Re: [PATCH V3 12/14] regulator: tps6524x: use devm_regulator_register()
Date: Thu, 26 Sep 2013 17:13:42 +0900 [thread overview]
Message-ID: <004101ceba90$50592700$f10b7500$%han@samsung.com> (raw)
In-Reply-To: <CAFRkauBTZQzSKgaNg781zsTU4u9V4rYATcWzC=BkJQy07sOBqA@mail.gmail.com>
On Thursday, September 26, 2013 5:06 PM, Axel Lin wrote:
> 2013/9/26 Jingoo Han <jg1.han@samsung.com>:
> > Use devm_regulator_register() to make cleanup paths simpler.
> >
> > Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> > ---
> > drivers/regulator/tps6524x-regulator.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
> > index 8b9ee39..8fe67fb 100644
> > --- a/drivers/regulator/tps6524x-regulator.c
> > +++ b/drivers/regulator/tps6524x-regulator.c
> > @@ -584,10 +584,8 @@ static int pmic_remove(struct spi_device *spi)
> >
> > if (!hw)
> > return 0;
> > - for (i = 0; i < N_REGULATORS; i++) {
> > - regulator_unregister(hw->rdev[i]);
> > + for (i = 0; i < N_REGULATORS; i++)
> > hw->rdev[i] = NULL;
> > - }
> > return 0;
> > }
> >
> > @@ -631,7 +629,8 @@ static int pmic_probe(struct spi_device *spi)
> > config.init_data = init_data;
> > config.driver_data = hw;
> >
> > - hw->rdev[i] = regulator_register(&hw->desc[i], &config);
> > + hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
> > + &config);
> > if (IS_ERR(hw->rdev[i])) {
> > ret = PTR_ERR(hw->rdev[i]);
> > hw->rdev[i] = NULL;
>
> I think you can simply return PTR_ERR(hw->rdev[i]) if devm_regulator_register()
> fails.
> You are using devm_regulator_register now, so don't need to call
> pmic_remove() in probe() error path.
> Then pmic_remove() and .remove = pmic_remove() can be removed as well.
>
CC'ed Sachin Kamat,
Hi Axel,
I really appreciate your comment.
Then, you mean the following.
If I am wrong, please let me know. :-)
Thank you.
static int pmic_probe(struct spi_device *spi)
{
......
hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
&config);
if (IS_ERR(hw->rdev[i]))
return PTR_ERR(hw->rdev[i]);
}
return 0;
}
static struct spi_driver pmic_driver = {
.probe = pmic_probe,
.driver = {
.name = "tps6524x",
.owner = THIS_MODULE,
},
};
Best regards,
Jingoo Han
next prev parent reply other threads:[~2013-09-26 8:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 7:46 [PATCH V3 01/14] regulator: ab3100: " Jingoo Han
2013-09-26 7:47 ` [PATCH V3 02/14] regulator: ab8500-ext: " Jingoo Han
2013-09-26 7:48 ` [PATCH V3 03/14] regulator: da9063: " Jingoo Han
2013-09-26 7:48 ` [PATCH V3 04/14] regulator: da9210: " Jingoo Han
2013-09-26 7:49 ` [PATCH V3 05/14] regulator: lp872x: " Jingoo Han
2013-09-26 7:50 ` [PATCH V3 06/14] regulator: lp8788-buck: " Jingoo Han
2013-09-26 7:50 ` From 782c15faac0a93cdac43b212073081707f669272 Mon Sep 17 00:00:00 2001 Jingoo Han
2013-09-26 7:55 ` Sachin Kamat
2013-09-26 8:00 ` Jingoo Han
2013-09-26 7:51 ` [PATCH V3 08/14] regulator: max8925: use devm_regulator_register() Jingoo Han
2013-09-26 7:51 ` [PATCH V3 09/14] regulator: pcap: " Jingoo Han
2013-09-26 7:52 ` [PATCH V3 10/14] regulator: pcf50633: " Jingoo Han
2013-09-26 7:52 ` [PATCH V3 11/14] regulator: tps6105x: " Jingoo Han
2013-09-26 7:53 ` [PATCH V3 12/14] regulator: tps6524x: " Jingoo Han
2013-09-26 8:06 ` Axel Lin
2013-09-26 8:13 ` Jingoo Han [this message]
2013-09-26 8:22 ` Axel Lin
2013-09-30 0:46 ` Jingoo Han
2013-09-26 7:53 ` [PATCH V3 13/14] regulator: twl: " Jingoo Han
2013-09-26 7:54 ` [PATCH V3 14/14] regulator: vexpress: " Jingoo Han
2013-09-26 7:57 ` [PATCH V3 07/14] regulator: lp8788-ldo: " Jingoo Han
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='004101ceba90$50592700$f10b7500$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sachin.kamat@linaro.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
all inboxes | Powered by JetHome®