Skip to contentSkip to conversation

gpio: loongson1 :remove unneeded platform_set_drvdata()call

PATCH In review Andrei Coardos 3 participants 3 messages Jul 19, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpio/gpio-loongson1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpio/gpio-loongson1.c +0 -2
index 6ca3b969db4d..2a57ffa0548b 100644
@@ -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);
 
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 7 lines · Andrei Coardos

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.

Quoted 23 lines
---
 drivers/gpio/gpio-loongson1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpio/gpio-loongson1.c +0 -3
index 6ca3b969db4d..2a57ffa0548b 100644
@@ -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

Signature · 3 lines
Best regards,

Keguang Zhang
Reviewed-by
#2 lore raw
Quoted 6 lines · Keguang Zhang
Quoted 4 lines · Andrei Coardos

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

Quoted 6 lines
Quoted 3 lines

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,

Signature · 2 lines
With Best Regards,
Andy Shevchenko