Skip to contentSkip to conversation

watchdog: da9052: use platform_{get,set}_drvdata()

PATCH In review Jingoo Han 3 participants 3 messages May 23, 2013 – May 26, 2013

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 2/5 watchdog: da9052: 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/watchdog/da9052_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/da9052_wdt.c +2 -2
index 3674450..f09c54e 100644
@@ -215,14 +215,14 @@ static int da9052_wdt_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	dev_set_drvdata(&pdev->dev, driver_data);
+	platform_set_drvdata(pdev, driver_data);
 err:
 	return ret;
 }
 
 static int da9052_wdt_remove(struct platform_device *pdev)
 {
-	struct da9052_wdt_data *driver_data = dev_get_drvdata(&pdev->dev);
+	struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&driver_data->wdt);
 	kref_put(&driver_data->kref, da9052_wdt_release_resources);
Signature · 1 line
1.7.10.4
maintainer Reviewed-by on v1 2/5
#1 lore raw
Quoted 5 lines · Jingoo Han

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.

Quoted 30 lines
---
 drivers/watchdog/da9052_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/da9052_wdt.c +2 -2
index 3674450..f09c54e 100644
@@ -215,14 +215,14 @@ static int da9052_wdt_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	dev_set_drvdata(&pdev->dev, driver_data);
+	platform_set_drvdata(pdev, driver_data);
 err:
 	return ret;
 }
 
 static int da9052_wdt_remove(struct platform_device *pdev)
 {
-	struct da9052_wdt_data *driver_data = dev_get_drvdata(&pdev->dev);
+	struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&driver_data->wdt);
 	kref_put(&driver_data->kref, da9052_wdt_release_resources);
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to Jingoo Han

Hi Jingoo,

Quoted 9 lines

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/watchdog/da9052_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch added to linux-watchdog-next.

Kind regards,
Wim.