Skip to contentSkip to conversation

gpio: msc313: remove unnecessary call to platform_set_drvdata()

PATCH In review Andrei Coardos 3 participants 5 messages Jul 21, 2023 – Jul 27, 2023

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

PATCH 1/1 gpio: msc313: remove unnecessary call to platform_set_drvdata()

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

---
 drivers/gpio/gpio-msc313.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpio/gpio-msc313.c +0 -2
index 036ad2324892..8e6835399d24 100644
@@ -643,8 +643,6 @@ static int msc313_gpio_probe(struct platform_device *pdev)
 	if (IS_ERR(gpio->base))
 		return PTR_ERR(gpio->base);
 
-	platform_set_drvdata(pdev, gpio);
-
 	gpiochip = devm_kzalloc(dev, sizeof(*gpiochip), GFP_KERNEL);
 	if (!gpiochip)
 		return -ENOMEM;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrei Coardos

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

Signature · 9 lines
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andrei Coardos

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver.

Not true.

Quoted 4 lines
Quoted 2 lines

Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

I have to withdraw this, the patch is wrong.
NAK.

Sorry for the confusion (I have looked for the wrong pattern).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw

Hi,

The private data is "struct msc313_gpio *gpio". This private data is "binded" to the gpio_chip via devm_gpiochip_add_data, right ? Then it is retrieved via gpiochip_get_data(chip), right ?

Romain

Quoted 23 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andrei Coardos

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver.

Not true.

Quoted 4 lines
Quoted 2 lines

Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

I have to withdraw this, the patch is wrong.
NAK.

Sorry for the confusion (I have looked for the wrong pattern).

--
With Best Regards,
Andy Shevchenko

#4 lore raw

On Thu, Jul 27, 2023 at 09:00:36AM +0200, Romain Perier wrote:

First of all, please do not top-post!

Quoted 2 lines

The private data is "struct msc313_gpio *gpio". This private data is "binded" to the gpio_chip via devm_gpiochip_add_data, right ?

No.

Quoted 1 line

Then it is retrieved via gpiochip_get_data(chip), right ?

No.

The driver data is used in PM callbacks. See below.

Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines · Andrei Coardos
Quoted 2 lines

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver.

Not true.

^^^^

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

I have to withdraw this, the patch is wrong.
NAK.

Sorry for the confusion (I have looked for the wrong pattern).

Signature · 2 lines
With Best Regards,
Andy Shevchenko