public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chris Zhong <zyw@rock-chips.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH] regulator: rk808: make better use of the gpiod API
Date: Tue, 21 Jul 2015 16:35:24 +0200	[thread overview]
Message-ID: <20150721143524.GD9981@pengutronix.de> (raw)
In-Reply-To: <CAJKOXPfY4zYtWKa6U4mzBjtS87HZepOV_hHodU2QJaJrLcr9qQ@mail.gmail.com>

Hello,

On Tue, Jul 21, 2015 at 10:09:32PM +0900, Krzysztof Kozlowski wrote:
> 2015-07-21 15:59 GMT+09:00 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > @@ -540,14 +540,19 @@ static int rk808_regulator_dt_parse_pdata(struct device *dev,
> >                 goto dt_parse_end;
> >
> >         for (i = 0; i < ARRAY_SIZE(pdata->dvs_gpio); i++) {
> > -               pdata->dvs_gpio[i] = gpiod_get_index(client_dev, "dvs", i);
> > +               pdata->dvs_gpio[i] =
> > +                       devm_gpiod_get_index_optional(client_dev, "dvs", i,
> > +                                                     GPIOD_OUT_LOW);
> >                 if (IS_ERR(pdata->dvs_gpio[i])) {
> > +                       dev_err(dev, "failed to get dvs%d gpio\n", i);
> 
> Missing of_node_put() from of_get_child_by_name() called before.
Good catch, thanks.

> > @@ -561,14 +566,6 @@ dt_parse_end:
> >
> >  static int rk808_regulator_remove(struct platform_device *pdev)
> >  {
> > -       struct rk808_regulator_data *pdata = platform_get_drvdata(pdev);
> > -       int i;
> > -
> > -       for (i = 0; i < ARRAY_SIZE(pdata->dvs_gpio); i++) {
> > -               if (!IS_ERR(pdata->dvs_gpio[i]))
> > -                       gpiod_put(pdata->dvs_gpio[i]);
> > -       }
> > -
> >         return 0;
> >  }
> 
> The function looks empty so it can be removed entirely.
I assumed that not having a remove function makes the device not
detachable. Not sure about that.
Looking at the code I found that not having a remove function can yield
surprises, though. If your driver has a probe but no remove function the
platform bus glue calls

	dev_pm_domain_attach(_dev, true);

at probe time, but not

	dev_pm_domain_detach(_dev, true);

at remove. I admit I don't know about that dev_pm_domain stuff, but it
looks wrong to only have one but not the other. Greg?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2015-07-21 14:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  3:29 linux-next: build failure after merge of the gpio tree Stephen Rothwell
2015-07-21  6:59 ` [PATCH] regulator: rk808: make better use of the gpiod API Uwe Kleine-König
2015-07-21  9:56   ` Linus Walleij
2015-07-21 11:04     ` Mark Brown
2015-07-21 14:21       ` Uwe Kleine-König
     [not found]         ` <1437489985-1362-1-git-send-email-uwe@kleine-koenig.org>
2015-07-21 14:46           ` [PATCH v2 2/2] " Uwe Kleine-König
2015-07-22  2:21             ` Krzysztof Kozlowski
2015-07-21 13:09   ` [PATCH] " Krzysztof Kozlowski
2015-07-21 14:35     ` Uwe Kleine-König [this message]
2015-07-21 14:41       ` Mark Brown
2015-07-22  0:13         ` Krzysztof Kozlowski
2015-07-22  7:13           ` Uwe Kleine-König

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=20150721143524.GD9981@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=zyw@rock-chips.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