Skip to contentSkip to conversation

net: davinci_mdio: use platform_{get,set}_drvdata()

PATCH Superseded Libo Chen 4 participants 7 messages Aug 12, 2013 – Aug 14, 2013

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Libo Chen

author
#0 lore raw

PATCH 8/8 net: davinci_mdio: use platform_{get,set}_drvdata()

Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device.

---
 drivers/net/ethernet/ti/davinci_mdio.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +1 -3
index 16ddfc3..2249b2c 100644
@@ -421,8 +421,7 @@ bail_out:
 
 static int davinci_mdio_remove(struct platform_device *pdev)
 {
-	struct device *dev = &pdev->dev;
-	struct davinci_mdio_data *data = dev_get_drvdata(dev);
+	struct davinci_mdio_data *data = platform_get_drvdata(pdev);
 
 	if (data->bus) {
 		mdiobus_unregister(data->bus);
@@ -434,7 +433,6 @@ static int davinci_mdio_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	dev_set_drvdata(dev, NULL);
 
 	kfree(data);
 
Signature · 1 line
1.7.1
#2 lore raw
In reply to Libo Chen
Quoted 13 lines · Libo Chen

Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device.

---
  drivers/net/ethernet/ti/davinci_mdio.c |    4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +0 -0
index 16ddfc3..2249b2c 100644

[...]

drivers/net/ethernet/ti/davinci_mdio.c static int davinci_mdio_remove(struct platform_device *pdev) · line 437

Quoted 5 lines
drivers/net/ethernet/ti/davinci_mdio.c +0 -1
@@ -434,7 +433,6 @@ static int davinci_mdio_remove(struct platform_device *pdev)
  	pm_runtime_put_sync(&pdev->dev);
  	pm_runtime_disable(&pdev->dev);
 
-	dev_set_drvdata(dev, NULL);

Doesn't get described as well. I think you're mixing two types of changes
in one patchset.

WBR, Sergei

maintainer
#3 lore raw

From: Sergei Shtylyov <[email protected]>
Date: Mon, 12 Aug 2013 22:17:47 +0400

Quoted 2 lines

Doesn't get described as well. I think you're mixing two types of changes in one patchset.

Agreed, you're going to have to redo this entire patch set.

author
#4 lore raw
Quoted 8 lines · David Miller

From: Sergei Shtylyov <[email protected]>
Date: Mon, 12 Aug 2013 22:17:47 +0400

Quoted 2 lines

Doesn't get described as well. I think you're mixing two types of changes in one patchset.

Agreed, you're going to have to redo this entire patch set.

okay, I will redo!

author
#5 lore raw
In reply to Sergei Shtylyov
Quoted 20 lines · Sergei Shtylyov
Quoted 13 lines · Libo Chen

Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device.

---
  drivers/net/ethernet/ti/davinci_mdio.c |    4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +0 -0
index 16ddfc3..2249b2c 100644

[...]

Quoted 4 lines
drivers/net/ethernet/ti/davinci_mdio.c +0 -0
@@ -434,7 +433,6 @@ static int davinci_mdio_remove(struct platform_device *pdev)
      pm_runtime_put_sync(&pdev->dev);
      pm_runtime_disable(&pdev->dev);
 
Quoted 6 lines

drivers/net/ethernet/ti/davinci_mdio.c static int davinci_mdio_remove(struct platform_device *pdev) · line 437

Quoted 1 line
drivers/net/ethernet/ti/davinci_mdio.c +0 -1
-    dev_set_drvdata(dev, NULL);

Doesn't get described as well. I think you're mixing two types of changes in one patchset.

WBR, Sergei

thanks for your attention!

Libo

Quoted 2 lines
author
#6 lore raw

PATCH RESEND 8/8 net: davinci_mdio: use platform_{get,set}_drvdata()

In reply to Libo Chen

We can use the wrapper functions platform_{get,set}_drvdata() instead of dev_{get,set}_drvdata() with &pdev->dev, it is convenient for user.

Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure.

---
 drivers/net/ethernet/ti/davinci_mdio.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +1 -3
index 16ddfc3..2249b2c 100644
@@ -421,8 +421,7 @@ bail_out:
 
 static int davinci_mdio_remove(struct platform_device *pdev)
 {
-	struct device *dev = &pdev->dev;
-	struct davinci_mdio_data *data = dev_get_drvdata(dev);
+	struct davinci_mdio_data *data = platform_get_drvdata(pdev);
 
 	if (data->bus) {
 		mdiobus_unregister(data->bus);
@@ -434,7 +433,6 @@ static int davinci_mdio_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	dev_set_drvdata(dev, NULL);
 
 	kfree(data);
 
Signature · 1 line
1.7.1