net/ethernet: using dev_get_drvdata directly
authorFuqian Huang <huangfq.daxian@gmail.com>
Thu, 4 Jul 2019 02:36:40 +0000 (10:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Jul 2019 22:25:04 +0000 (15:25 -0700)
Several drivers cast a struct device pointer to a struct
platform_device pointer only to then call platform_get_drvdata().
To improve readability, these constructs can be simplified
by using dev_get_drvdata() directly.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/calxeda/xgmac.c

index 11d4e91ea754b1c7f7b7ce542ee9a2964c958b6e..99f49d059414624f2a359b54c91eebfb2178f50a 100644 (file)
@@ -1855,7 +1855,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode)
 
 static int xgmac_suspend(struct device *dev)
 {
-       struct net_device *ndev = platform_get_drvdata(to_platform_device(dev));
+       struct net_device *ndev = dev_get_drvdata(dev);
        struct xgmac_priv *priv = netdev_priv(ndev);
        u32 value;
 
@@ -1881,7 +1881,7 @@ static int xgmac_suspend(struct device *dev)
 
 static int xgmac_resume(struct device *dev)
 {
-       struct net_device *ndev = platform_get_drvdata(to_platform_device(dev));
+       struct net_device *ndev = dev_get_drvdata(dev);
        struct xgmac_priv *priv = netdev_priv(ndev);
        void __iomem *ioaddr = priv->base;