]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: ethernet: ti: cpsw: simplify getting .driver_data
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Sun, 21 Oct 2018 20:00:17 +0000 (22:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Oct 2018 04:10:12 +0000 (21:10 -0700)
We should get 'driver_data' 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: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 226be2a56c1f22417c3cbdf0360ee2ca5f4a987e..6cf4d4cb152ef8ae52d895dc89aab86547872210 100644 (file)
@@ -3669,8 +3669,7 @@ static int cpsw_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int cpsw_suspend(struct device *dev)
 {
-       struct platform_device  *pdev = to_platform_device(dev);
-       struct net_device       *ndev = platform_get_drvdata(pdev);
+       struct net_device       *ndev = dev_get_drvdata(dev);
        struct cpsw_common      *cpsw = ndev_to_cpsw(ndev);
 
        if (cpsw->data.dual_emac) {
@@ -3693,8 +3692,7 @@ static int cpsw_suspend(struct device *dev)
 
 static int cpsw_resume(struct device *dev)
 {
-       struct platform_device  *pdev = to_platform_device(dev);
-       struct net_device       *ndev = platform_get_drvdata(pdev);
+       struct net_device       *ndev = dev_get_drvdata(dev);
        struct cpsw_common      *cpsw = ndev_to_cpsw(ndev);
 
        /* Select default pin state */