linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Ardelean <aardelean@deviqon.com>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio <linux-gpio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] gpio: gpio-xgene: simplify probe, return devm_gpiochip_add_data() directly
Date: Mon, 24 May 2021 10:21:20 +0300	[thread overview]
Message-ID: <CAASAkoZWeQ3xSB3P-fLrym+_0b23HRuvaw3LW2Zgy9CVKr3AWQ@mail.gmail.com> (raw)
In-Reply-To: <CAMpxmJW1Q-m_W+n28V9sEqvnb4ZVTGq_55DedhuJxu5icuD9sQ@mail.gmail.com>

On Sun, 23 May 2021 at 21:31, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> On Fri, May 21, 2021 at 8:10 PM Alexandru Ardelean
> <aardelean@deviqon.com> wrote:
> >
> > The handling of the return value from devm_gpiochip_add_data() is a bit
> > redundant. It prints messages on error and success cases.
> > While the success message may be useful, it is more in the area of log
> > spam, and these can be printed with other forms of kernel logging.
> >
> > This change does a direct return with devm_gpiochip_add_data() in the probe
> > function.
> >
> > The platform_set_drvdata() is needed, as this driver uses the stored
> > private date in the PM suspend/resume routines.
> >
> > Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
> > ---
> >  drivers/gpio/gpio-xgene.c | 11 +----------
> >  1 file changed, 1 insertion(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
> > index 532b0df8a1f2..fb4b0c67aeef 100644
> > --- a/drivers/gpio/gpio-xgene.c
> > +++ b/drivers/gpio/gpio-xgene.c
> > @@ -159,7 +159,6 @@ static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
> >  static int xgene_gpio_probe(struct platform_device *pdev)
> >  {
> >         struct xgene_gpio *gpio;
> > -       int err = 0;
> >
> >         gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> >         if (!gpio)
> > @@ -183,15 +182,7 @@ static int xgene_gpio_probe(struct platform_device *pdev)
> >
> >         platform_set_drvdata(pdev, gpio);
> >
> > -       err = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
> > -       if (err) {
> > -               dev_err(&pdev->dev,
> > -                       "failed to register gpiochip.\n");
> > -               return err;
> > -       }
> > -
> > -       dev_info(&pdev->dev, "X-Gene GPIO driver registered.\n");
> > -       return 0;
> > +       return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
> >  }
> >
> >  static const struct of_device_id xgene_gpio_of_match[] = {
> > --
> > 2.31.1
> >
>
> Applied, thanks.
>
> For the future: the subject should be: "gpio: xgene: ..." here and
> everywhere else.

ack
will keep that in mind

thanks :)
Alex

>
> Bart

      reply	other threads:[~2021-05-24  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 18:10 [PATCH] gpio: gpio-xgene: simplify probe, return devm_gpiochip_add_data() directly Alexandru Ardelean
2021-05-23 18:31 ` Bartosz Golaszewski
2021-05-24  7:21   ` Alexandru Ardelean [this message]

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=CAASAkoZWeQ3xSB3P-fLrym+_0b23HRuvaw3LW2Zgy9CVKr3AWQ@mail.gmail.com \
    --to=aardelean@deviqon.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).