diff mbox

[1/3] i2c: omap: switch to dev_get_drvdata()

Message ID 1435260890-32335-1-git-send-email-balbi@ti.com
State Accepted
Headers show

Commit Message

Felipe Balbi June 25, 2015, 7:34 p.m. UTC
there's no need to fetch the platform_device
in order to dereference it back to the dev
pointer to access drvdata, we can use
dev_get_drvdata() instead.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/i2c/busses/i2c-omap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Alexander A Sverdlin July 9, 2015, 10:09 a.m. UTC | #1
Hi!

On 25/06/15 21:34, ext Felipe Balbi wrote:
> there's no need to fetch the platform_device
> in order to dereference it back to the dev
> pointer to access drvdata, we can use
> dev_get_drvdata() instead.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>

Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>

> ---
>  drivers/i2c/busses/i2c-omap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 0e894193accf..00712c1cf3c0 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1403,8 +1403,7 @@ static int omap_i2c_remove(struct platform_device *pdev)
>  #ifdef CONFIG_PM
>  static int omap_i2c_runtime_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
> +	struct omap_i2c_dev *_dev = dev_get_drvdata(dev);
>  
>  	_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
>  
> @@ -1428,8 +1427,7 @@ static int omap_i2c_runtime_suspend(struct device *dev)
>  
>  static int omap_i2c_runtime_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
> +	struct omap_i2c_dev *_dev = dev_get_drvdata(dev);
>  
>  	if (!_dev->regs)
>  		return 0;
Wolfram Sang July 9, 2015, 7:46 p.m. UTC | #2
On Thu, Jun 25, 2015 at 02:34:48PM -0500, Felipe Balbi wrote:
> there's no need to fetch the platform_device
> in order to dereference it back to the dev
> pointer to access drvdata, we can use
> dev_get_drvdata() instead.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>

Applied to for-next, thanks!
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 0e894193accf..00712c1cf3c0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1403,8 +1403,7 @@  static int omap_i2c_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int omap_i2c_runtime_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+	struct omap_i2c_dev *_dev = dev_get_drvdata(dev);
 
 	_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
 
@@ -1428,8 +1427,7 @@  static int omap_i2c_runtime_suspend(struct device *dev)
 
 static int omap_i2c_runtime_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+	struct omap_i2c_dev *_dev = dev_get_drvdata(dev);
 
 	if (!_dev->regs)
 		return 0;