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: viperboard: remove platform_set_drvdata() call in probe
Date: Wed, 21 Jul 2021 17:13:30 +0300	[thread overview]
Message-ID: <CAASAkoYhg2VQB5En8=pybeHngnApaYoStg3ZB9=J-ZMofD7Rkg@mail.gmail.com> (raw)
In-Reply-To: <CAMpxmJVBTqX_e6a7PjdNmwYN-SCgqXQ1WbfzZbRLBGvPSVHTFQ@mail.gmail.com>

On Wed, 21 Jul 2021 at 16:16, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> On Wed, Jul 7, 2021 at 3:51 PM Alexandru Ardelean <aardelean@deviqon.com> wrote:
> >
> > The platform_set_drvdata() call is only useful if we need to retrieve back
> > the private information.
> > Since the driver doesn't do that, it's not useful to have it.
> >
> > This change removes it.
> >
> > Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
> > ---
> >  drivers/gpio/gpio-viperboard.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
> > index c301c1d56dd2..98ddd6590362 100644
> > --- a/drivers/gpio/gpio-viperboard.c
> > +++ b/drivers/gpio/gpio-viperboard.c
> > @@ -422,12 +422,8 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
> >         vb_gpio->gpiob.direction_input = vprbrd_gpiob_direction_input;
> >         vb_gpio->gpiob.direction_output = vprbrd_gpiob_direction_output;
> >         ret = devm_gpiochip_add_data(&pdev->dev, &vb_gpio->gpiob, vb_gpio);
> > -       if (ret < 0) {
> > +       if (ret < 0)
> >                 dev_err(vb_gpio->gpiob.parent, "could not add gpio b");
> > -               return ret;
> > -       }
> > -
> > -       platform_set_drvdata(pdev, vb_gpio);
> >
> >         return ret;
> >  }
> > --
> > 2.31.1
> >
>
> The log is not really needed, we'll get an error message from gpiolib
> core. Can you remove it while you're at it and just return the result
> of devm_gpiochip_add_data()?

I thought about removing it, but in this driver there are 2
devm_gpiochip_add_data() calls.
It registers 2 GPIOchip instances.
Which is not so easy to see in this patch.

First one says "could not add gpio a"  and this one says "could not add gpio b".
I hesitated to remove either of these.

In this case, it may be a little helpful to know which GPIOchip failed
to be registered.

But I don't mind removing them both.
Whatever you prefer. I'm undecided.

>
> Bart

  reply	other threads:[~2021-07-21 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 13:51 [PATCH] gpio: viperboard: remove platform_set_drvdata() call in probe Alexandru Ardelean
2021-07-21 13:16 ` Bartosz Golaszewski
2021-07-21 14:13   ` Alexandru Ardelean [this message]
2021-07-27 13:32     ` Bartosz Golaszewski
2021-08-25  7:01 ` [PATCH v2] " Alexandru Ardelean
2021-08-31  9:29   ` Bartosz Golaszewski

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='CAASAkoYhg2VQB5En8=pybeHngnApaYoStg3ZB9=J-ZMofD7Rkg@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).