* [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata()
@ 2020-11-19 14:21 Alexandru Ardelean
2020-11-19 15:05 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Alexandru Ardelean @ 2020-11-19 14:21 UTC (permalink / raw)
To: linux-gpio, linux-kernel
Cc: nandor.han, semi.malinen, linus.walleij, bgolaszewski,
Alexandru Ardelean
There is no matching spi_get_drvdata() call in the driver, so there is no
need to do spi_set_drvdata(). This looks like it probably was copied from a
driver that used both spi_set_drvdata() & spi_get_drvdata().
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/gpio/gpio-xra1403.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
index e2cac12092af..49c878cfd5c6 100644
--- a/drivers/gpio/gpio-xra1403.c
+++ b/drivers/gpio/gpio-xra1403.c
@@ -186,15 +186,7 @@ static int xra1403_probe(struct spi_device *spi)
return ret;
}
- ret = devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
- if (ret < 0) {
- dev_err(&spi->dev, "Unable to register gpiochip\n");
- return ret;
- }
-
- spi_set_drvdata(spi, xra);
-
- return 0;
+ return devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
}
static const struct spi_device_id xra1403_ids[] = {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata()
2020-11-19 14:21 [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata() Alexandru Ardelean
@ 2020-11-19 15:05 ` Andy Shevchenko
2020-11-30 16:37 ` Bartosz Golaszewski
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-19 15:05 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: open list:GPIO SUBSYSTEM, Linux Kernel Mailing List, Nandor Han,
Semi Malinen, Linus Walleij, Bartosz Golaszewski
On Thu, Nov 19, 2020 at 4:17 PM Alexandru Ardelean
<alexandru.ardelean@analog.com> wrote:
>
> There is no matching spi_get_drvdata() call in the driver, so there is no
> need to do spi_set_drvdata(). This looks like it probably was copied from a
> driver that used both spi_set_drvdata() & spi_get_drvdata().
While above luckily (*) okay it may not always be the case.
*) it can be paired with dev_get_drvdata() which is usual for PM callbacks.
With amended commit message
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
> drivers/gpio/gpio-xra1403.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
> index e2cac12092af..49c878cfd5c6 100644
> --- a/drivers/gpio/gpio-xra1403.c
> +++ b/drivers/gpio/gpio-xra1403.c
> @@ -186,15 +186,7 @@ static int xra1403_probe(struct spi_device *spi)
> return ret;
> }
>
> - ret = devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
> - if (ret < 0) {
> - dev_err(&spi->dev, "Unable to register gpiochip\n");
> - return ret;
> - }
> -
> - spi_set_drvdata(spi, xra);
> -
> - return 0;
> + return devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
> }
>
> static const struct spi_device_id xra1403_ids[] = {
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata()
2020-11-19 15:05 ` Andy Shevchenko
@ 2020-11-30 16:37 ` Bartosz Golaszewski
2020-11-30 17:16 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 16:37 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Alexandru Ardelean, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, Nandor Han, Semi Malinen,
Linus Walleij
On Thu, Nov 19, 2020 at 4:04 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Thu, Nov 19, 2020 at 4:17 PM Alexandru Ardelean
> <alexandru.ardelean@analog.com> wrote:
> >
> > There is no matching spi_get_drvdata() call in the driver, so there is no
> > need to do spi_set_drvdata(). This looks like it probably was copied from a
> > driver that used both spi_set_drvdata() & spi_get_drvdata().
>
> While above luckily (*) okay it may not always be the case.
>
> *) it can be paired with dev_get_drvdata() which is usual for PM callbacks.
>
> With amended commit message
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
I applied this patch. I wasn't sure exactly how you want the commit
message to be changed - it sounds pretty clear to me so I took it.
Bartosz
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> > drivers/gpio/gpio-xra1403.c | 10 +---------
> > 1 file changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
> > index e2cac12092af..49c878cfd5c6 100644
> > --- a/drivers/gpio/gpio-xra1403.c
> > +++ b/drivers/gpio/gpio-xra1403.c
> > @@ -186,15 +186,7 @@ static int xra1403_probe(struct spi_device *spi)
> > return ret;
> > }
> >
> > - ret = devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
> > - if (ret < 0) {
> > - dev_err(&spi->dev, "Unable to register gpiochip\n");
> > - return ret;
> > - }
> > -
> > - spi_set_drvdata(spi, xra);
> > -
> > - return 0;
> > + return devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
> > }
> >
> > static const struct spi_device_id xra1403_ids[] = {
> > --
> > 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata()
2020-11-30 16:37 ` Bartosz Golaszewski
@ 2020-11-30 17:16 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-30 17:16 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Alexandru Ardelean, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, Nandor Han, Linus Walleij
On Mon, Nov 30, 2020 at 6:37 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> On Thu, Nov 19, 2020 at 4:04 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > On Thu, Nov 19, 2020 at 4:17 PM Alexandru Ardelean
> > <alexandru.ardelean@analog.com> wrote:
> > >
> > > There is no matching spi_get_drvdata() call in the driver, so there is no
> > > need to do spi_set_drvdata(). This looks like it probably was copied from a
> > > driver that used both spi_set_drvdata() & spi_get_drvdata().
> >
> > While above luckily (*) okay it may not always be the case.
> >
> > *) it can be paired with dev_get_drvdata() which is usual for PM callbacks.
> >
> > With amended commit message
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> >
>
> I applied this patch. I wasn't sure exactly how you want the commit
> message to be changed - it sounds pretty clear to me so I took it.
For example, by adding " or dev_get_drvdata()" to the end.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-30 17:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 14:21 [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata() Alexandru Ardelean
2020-11-19 15:05 ` Andy Shevchenko
2020-11-30 16:37 ` Bartosz Golaszewski
2020-11-30 17:16 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.