Commit f54b0fc8 authored by Chuhong Yuan's avatar Chuhong Yuan Committed by David S. Miller

net: atheros: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9f293c9a
...@@ -1877,8 +1877,7 @@ static void alx_remove(struct pci_dev *pdev) ...@@ -1877,8 +1877,7 @@ static void alx_remove(struct pci_dev *pdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int alx_suspend(struct device *dev) static int alx_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct alx_priv *alx = dev_get_drvdata(dev);
struct alx_priv *alx = pci_get_drvdata(pdev);
if (!netif_running(alx->dev)) if (!netif_running(alx->dev))
return 0; return 0;
...@@ -1889,8 +1888,7 @@ static int alx_suspend(struct device *dev) ...@@ -1889,8 +1888,7 @@ static int alx_suspend(struct device *dev)
static int alx_resume(struct device *dev) static int alx_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct alx_priv *alx = dev_get_drvdata(dev);
struct alx_priv *alx = pci_get_drvdata(pdev);
struct alx_hw *hw = &alx->hw; struct alx_hw *hw = &alx->hw;
int err; int err;
......
...@@ -2420,8 +2420,7 @@ static int atl1c_close(struct net_device *netdev) ...@@ -2420,8 +2420,7 @@ static int atl1c_close(struct net_device *netdev)
static int atl1c_suspend(struct device *dev) static int atl1c_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct net_device *netdev = dev_get_drvdata(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_adapter *adapter = netdev_priv(netdev);
struct atl1c_hw *hw = &adapter->hw; struct atl1c_hw *hw = &adapter->hw;
u32 wufc = adapter->wol; u32 wufc = adapter->wol;
...@@ -2435,7 +2434,7 @@ static int atl1c_suspend(struct device *dev) ...@@ -2435,7 +2434,7 @@ static int atl1c_suspend(struct device *dev)
if (wufc) if (wufc)
if (atl1c_phy_to_ps_link(hw) != 0) if (atl1c_phy_to_ps_link(hw) != 0)
dev_dbg(&pdev->dev, "phy power saving failed"); dev_dbg(dev, "phy power saving failed");
atl1c_power_saving(hw, wufc); atl1c_power_saving(hw, wufc);
...@@ -2445,8 +2444,7 @@ static int atl1c_suspend(struct device *dev) ...@@ -2445,8 +2444,7 @@ static int atl1c_suspend(struct device *dev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int atl1c_resume(struct device *dev) static int atl1c_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct net_device *netdev = dev_get_drvdata(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_adapter *adapter = netdev_priv(netdev);
AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0);
......
...@@ -2753,8 +2753,7 @@ static int atl1_close(struct net_device *netdev) ...@@ -2753,8 +2753,7 @@ static int atl1_close(struct net_device *netdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int atl1_suspend(struct device *dev) static int atl1_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct net_device *netdev = dev_get_drvdata(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct atl1_adapter *adapter = netdev_priv(netdev); struct atl1_adapter *adapter = netdev_priv(netdev);
struct atl1_hw *hw = &adapter->hw; struct atl1_hw *hw = &adapter->hw;
u32 ctrl = 0; u32 ctrl = 0;
...@@ -2779,7 +2778,7 @@ static int atl1_suspend(struct device *dev) ...@@ -2779,7 +2778,7 @@ static int atl1_suspend(struct device *dev)
val = atl1_get_speed_and_duplex(hw, &speed, &duplex); val = atl1_get_speed_and_duplex(hw, &speed, &duplex);
if (val) { if (val) {
if (netif_msg_ifdown(adapter)) if (netif_msg_ifdown(adapter))
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, dev,
"error getting speed/duplex\n"); "error getting speed/duplex\n");
goto disable_wol; goto disable_wol;
} }
...@@ -2836,8 +2835,7 @@ static int atl1_suspend(struct device *dev) ...@@ -2836,8 +2835,7 @@ static int atl1_suspend(struct device *dev)
static int atl1_resume(struct device *dev) static int atl1_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct net_device *netdev = dev_get_drvdata(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct atl1_adapter *adapter = netdev_priv(netdev); struct atl1_adapter *adapter = netdev_priv(netdev);
iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL); iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment