aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-11-16 22:26:54 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2010-11-16 22:26:54 -0500
commitc60fbb00f0400792adf873dbacd431885653b77d (patch)
tree69ef3142e40a97afca11aa13cfcdc026f7e4c63b /drivers/net/ixgbe/ixgbe_main.c
parent01fa7d905fe9a5b045615fbde19e6c0f78063206 (diff)
ixgbe: move adapter into pci_dev driver data instead of netdev
This change moves an adapter pointer into the private portion of the pci_dev instead of a pointer to the netdev. The reason for this change is because in most cases we just want the adapter anyway. In addition as we start moving toward multiple netdevs per port we may want to move the adapter pointer out of the netdevs entirely. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index dd73ebc545d3..75e25bc91a99 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -887,8 +887,7 @@ static void ixgbe_setup_dca(struct ixgbe_adapter *adapter)
887 887
888static int __ixgbe_notify_dca(struct device *dev, void *data) 888static int __ixgbe_notify_dca(struct device *dev, void *data)
889{ 889{
890 struct net_device *netdev = dev_get_drvdata(dev); 890 struct ixgbe_adapter *adapter = dev_get_drvdata(dev);
891 struct ixgbe_adapter *adapter = netdev_priv(netdev);
892 unsigned long event = *(unsigned long *)data; 891 unsigned long event = *(unsigned long *)data;
893 892
894 switch (event) { 893 switch (event) {
@@ -5255,8 +5254,8 @@ static int ixgbe_close(struct net_device *netdev)
5255#ifdef CONFIG_PM 5254#ifdef CONFIG_PM
5256static int ixgbe_resume(struct pci_dev *pdev) 5255static int ixgbe_resume(struct pci_dev *pdev)
5257{ 5256{
5258 struct net_device *netdev = pci_get_drvdata(pdev); 5257 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
5259 struct ixgbe_adapter *adapter = netdev_priv(netdev); 5258 struct net_device *netdev = adapter->netdev;
5260 u32 err; 5259 u32 err;
5261 5260
5262 pci_set_power_state(pdev, PCI_D0); 5261 pci_set_power_state(pdev, PCI_D0);
@@ -5287,7 +5286,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
5287 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); 5286 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
5288 5287
5289 if (netif_running(netdev)) { 5288 if (netif_running(netdev)) {
5290 err = ixgbe_open(adapter->netdev); 5289 err = ixgbe_open(netdev);
5291 if (err) 5290 if (err)
5292 return err; 5291 return err;
5293 } 5292 }
@@ -5300,8 +5299,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
5300 5299
5301static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) 5300static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
5302{ 5301{
5303 struct net_device *netdev = pci_get_drvdata(pdev); 5302 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
5304 struct ixgbe_adapter *adapter = netdev_priv(netdev); 5303 struct net_device *netdev = adapter->netdev;
5305 struct ixgbe_hw *hw = &adapter->hw; 5304 struct ixgbe_hw *hw = &adapter->hw;
5306 u32 ctrl, fctrl; 5305 u32 ctrl, fctrl;
5307 u32 wufc = adapter->wol; 5306 u32 wufc = adapter->wol;
@@ -6762,8 +6761,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
6762 6761
6763 SET_NETDEV_DEV(netdev, &pdev->dev); 6762 SET_NETDEV_DEV(netdev, &pdev->dev);
6764 6763
6765 pci_set_drvdata(pdev, netdev);
6766 adapter = netdev_priv(netdev); 6764 adapter = netdev_priv(netdev);
6765 pci_set_drvdata(pdev, adapter);
6767 6766
6768 adapter->netdev = netdev; 6767 adapter->netdev = netdev;
6769 adapter->pdev = pdev; 6768 adapter->pdev = pdev;
@@ -7086,8 +7085,8 @@ err_dma:
7086 **/ 7085 **/
7087static void __devexit ixgbe_remove(struct pci_dev *pdev) 7086static void __devexit ixgbe_remove(struct pci_dev *pdev)
7088{ 7087{
7089 struct net_device *netdev = pci_get_drvdata(pdev); 7088 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
7090 struct ixgbe_adapter *adapter = netdev_priv(netdev); 7089 struct net_device *netdev = adapter->netdev;
7091 7090
7092 set_bit(__IXGBE_DOWN, &adapter->state); 7091 set_bit(__IXGBE_DOWN, &adapter->state);
7093 /* clear the module not found bit to make sure the worker won't 7092 /* clear the module not found bit to make sure the worker won't
@@ -7157,8 +7156,8 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
7157static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, 7156static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
7158 pci_channel_state_t state) 7157 pci_channel_state_t state)
7159{ 7158{
7160 struct net_device *netdev = pci_get_drvdata(pdev); 7159 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
7161 struct ixgbe_adapter *adapter = netdev_priv(netdev); 7160 struct net_device *netdev = adapter->netdev;
7162 7161
7163 netif_device_detach(netdev); 7162 netif_device_detach(netdev);
7164 7163
@@ -7181,8 +7180,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
7181 */ 7180 */
7182static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) 7181static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
7183{ 7182{
7184 struct net_device *netdev = pci_get_drvdata(pdev); 7183 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
7185 struct ixgbe_adapter *adapter = netdev_priv(netdev);
7186 pci_ers_result_t result; 7184 pci_ers_result_t result;
7187 int err; 7185 int err;
7188 7186
@@ -7220,8 +7218,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
7220 */ 7218 */
7221static void ixgbe_io_resume(struct pci_dev *pdev) 7219static void ixgbe_io_resume(struct pci_dev *pdev)
7222{ 7220{
7223 struct net_device *netdev = pci_get_drvdata(pdev); 7221 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
7224 struct ixgbe_adapter *adapter = netdev_priv(netdev); 7222 struct net_device *netdev = adapter->netdev;
7225 7223
7226 if (netif_running(netdev)) { 7224 if (netif_running(netdev)) {
7227 if (ixgbe_up(adapter)) { 7225 if (ixgbe_up(adapter)) {