2023-07-19 10:31:16

by Andrei Coardos

[permalink] [raw]
Subject: [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call

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 <[email protected]>
Signed-off-by: Andrei Coardos <[email protected]>
---
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



2023-07-19 12:33:21

by Keguang Zhang

[permalink] [raw]
Subject: Re: [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call

On Wed, Jul 19, 2023 at 6:14 PM Andrei Coardos <[email protected]> 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 <[email protected]>
> Signed-off-by: Andrei Coardos <[email protected]>
> ---
> 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

2023-07-19 13:51:12

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] gpio: loongson1 :remove unneeded platform_set_drvdata()call

On Wed, Jul 19, 2023 at 3:30 PM Keguang Zhang <[email protected]> wrote:
>
> On Wed, Jul 19, 2023 at 6:14 PM Andrei Coardos <[email protected]> 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 <[email protected]>


--
With Best Regards,
Andy Shevchenko