]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: phy: simplify getting .drvdata
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 19 Apr 2018 14:06:26 +0000 (16:06 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 15 May 2018 07:11:17 +0000 (10:11 +0300)
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy-am335x.c

index b36fa8b953d0e9a7508dff0250a78998e5335b97..27bdb72225272394d1d1001dc8d50e17c0186601 100644 (file)
@@ -96,8 +96,7 @@ static int am335x_phy_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int am335x_phy_suspend(struct device *dev)
 {
-       struct platform_device  *pdev = to_platform_device(dev);
-       struct am335x_phy *am_phy = platform_get_drvdata(pdev);
+       struct am335x_phy *am_phy = dev_get_drvdata(dev);
 
        /*
         * Enable phy wakeup only if dev->power.can_wakeup is true.
@@ -117,8 +116,7 @@ static int am335x_phy_suspend(struct device *dev)
 
 static int am335x_phy_resume(struct device *dev)
 {
-       struct platform_device  *pdev = to_platform_device(dev);
-       struct am335x_phy       *am_phy = platform_get_drvdata(pdev);
+       struct am335x_phy       *am_phy = dev_get_drvdata(dev);
 
        phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, true);