public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call
@ 2023-07-19 10:13 Andrei Coardos
  2023-07-19 12:30 ` Keguang Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Coardos @ 2023-07-19 10:13 UTC (permalink / raw)
  To: linux-kernel, linux-gpio, linux-mips
  Cc: andy, brgl, linus.walleij, keguang.zhang, Andrei Coardos,
	Alexandru Ardelean

In the drivers/gpio/gpio-loongson1 the call to platform_set_drvdata was
removed.
This function call was found to be unnecesarry as the associated
structure is defined inside the local .c file.
It doesn't use any type of function either so it can be removed without
any complications.

Reviewed-by: Alexandru Ardelean <alex@shruggie.ro>
Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com>
---
 drivers/gpio/gpio-loongson1.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpio/gpio-loongson1.c b/drivers/gpio/gpio-loongson1.c
index 6ca3b969db4d..2a57ffa0548b 100644
--- a/drivers/gpio/gpio-loongson1.c
+++ b/drivers/gpio/gpio-loongson1.c
@@ -78,8 +78,6 @@ static int ls1x_gpio_probe(struct platform_device *pdev)
 	if (ret)
 		goto err;
 
-	platform_set_drvdata(pdev, ls1x_gc);
-
 	dev_info(dev, "GPIO controller registered with %d pins\n",
 		 ls1x_gc->gc.ngpio);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call
  2023-07-19 10:13 [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call Andrei Coardos
@ 2023-07-19 12:30 ` Keguang Zhang
  2023-07-19 13:05   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Keguang Zhang @ 2023-07-19 12:30 UTC (permalink / raw)
  To: Andrei Coardos
  Cc: linux-kernel, linux-gpio, linux-mips, andy, brgl, linus.walleij,
	Alexandru Ardelean

On Wed, Jul 19, 2023 at 6:14 PM Andrei Coardos <aboutphysycs@gmail.com> wrote:
>
> In the drivers/gpio/gpio-loongson1 the call to platform_set_drvdata was
> removed.
> This function call was found to be unnecesarry as the associated
> structure is defined inside the local .c file.
> It doesn't use any type of function either so it can be removed without
> any complications.

If there is a ls1x_gpio_remove(), platform_get_drvdata() will be called.
Then platform_set_drvdata() will be necessary.
>
> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro>
> Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com>
> ---
>  drivers/gpio/gpio-loongson1.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-loongson1.c b/drivers/gpio/gpio-loongson1.c
> index 6ca3b969db4d..2a57ffa0548b 100644
> --- a/drivers/gpio/gpio-loongson1.c
> +++ b/drivers/gpio/gpio-loongson1.c
> @@ -78,8 +78,6 @@ static int ls1x_gpio_probe(struct platform_device *pdev)
>         if (ret)
>                 goto err;
>
> -       platform_set_drvdata(pdev, ls1x_gc);
> -
>         dev_info(dev, "GPIO controller registered with %d pins\n",
>                  ls1x_gc->gc.ngpio);
>
> --
> 2.34.1
>


-- 
Best regards,

Keguang Zhang

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call
  2023-07-19 12:30 ` Keguang Zhang
@ 2023-07-19 13:05   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-07-19 13:05 UTC (permalink / raw)
  To: Keguang Zhang
  Cc: Andrei Coardos, linux-kernel, linux-gpio, linux-mips, andy, brgl,
	linus.walleij, Alexandru Ardelean

On Wed, Jul 19, 2023 at 3:30 PM Keguang Zhang <keguang.zhang@gmail.com> wrote:
>
> On Wed, Jul 19, 2023 at 6:14 PM Andrei Coardos <aboutphysycs@gmail.com> wrote:
> >
> > In the drivers/gpio/gpio-loongson1 the call to platform_set_drvdata was
> > removed.
> > This function call was found to be unnecesarry as the associated

unnecessary

> > structure is defined inside the local .c file.
> > It doesn't use any type of function either so it can be removed without
> > any complications.
>
> If there is a ls1x_gpio_remove(), platform_get_drvdata() will be called.
> Then platform_set_drvdata() will be necessary.

I don't get this. Is it just a side note? To me the patch looks legit.

...

With typo fixed,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-19 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19 10:13 [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call Andrei Coardos
2023-07-19 12:30 ` Keguang Zhang
2023-07-19 13:05   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox