e1000e: Use dev_get_drvdata where possible
authorChuhong Yuan <hslester96@gmail.com>
Tue, 23 Jul 2019 14:15:13 +0000 (22:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Jul 2019 20:02:41 +0000 (13:02 -0700)
Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/intel/e1000e/netdev.c

index a0c001d..8a3f035 100644 (file)
@@ -6296,7 +6296,7 @@ fl_out:
 
 static int e1000e_pm_freeze(struct device *dev)
 {
-       struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
+       struct net_device *netdev = dev_get_drvdata(dev);
        struct e1000_adapter *adapter = netdev_priv(netdev);
 
        netif_device_detach(netdev);
@@ -6629,7 +6629,7 @@ static int __e1000_resume(struct pci_dev *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int e1000e_pm_thaw(struct device *dev)
 {
-       struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
+       struct net_device *netdev = dev_get_drvdata(dev);
        struct e1000_adapter *adapter = netdev_priv(netdev);
 
        e1000e_set_interrupt_capability(adapter);
@@ -6678,8 +6678,7 @@ static int e1000e_pm_resume(struct device *dev)
 
 static int e1000e_pm_runtime_idle(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct net_device *netdev = pci_get_drvdata(pdev);
+       struct net_device *netdev = dev_get_drvdata(dev);
        struct e1000_adapter *adapter = netdev_priv(netdev);
        u16 eee_lp;