diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/igb/igb.h | 4 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 50 |
2 files changed, 10 insertions, 44 deletions
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h index 30657ddf4842..530d7aa4cb86 100644 --- a/drivers/net/igb/igb.h +++ b/drivers/net/igb/igb.h | |||
@@ -273,10 +273,6 @@ struct igb_adapter { | |||
273 | unsigned int flags; | 273 | unsigned int flags; |
274 | u32 eeprom_wol; | 274 | u32 eeprom_wol; |
275 | 275 | ||
276 | /* for ioport free */ | ||
277 | int bars; | ||
278 | int need_ioport; | ||
279 | |||
280 | struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES]; | 276 | struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES]; |
281 | unsigned int tx_ring_count; | 277 | unsigned int tx_ring_count; |
282 | unsigned int rx_ring_count; | 278 | unsigned int rx_ring_count; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 6ef0adb7a06d..13b10ba8a3c4 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -974,21 +974,6 @@ void igb_reset(struct igb_adapter *adapter) | |||
974 | igb_get_phy_info(&adapter->hw); | 974 | igb_get_phy_info(&adapter->hw); |
975 | } | 975 | } |
976 | 976 | ||
977 | /** | ||
978 | * igb_is_need_ioport - determine if an adapter needs ioport resources or not | ||
979 | * @pdev: PCI device information struct | ||
980 | * | ||
981 | * Returns true if an adapter needs ioport resources | ||
982 | **/ | ||
983 | static int igb_is_need_ioport(struct pci_dev *pdev) | ||
984 | { | ||
985 | switch (pdev->device) { | ||
986 | /* Currently there are no adapters that need ioport resources */ | ||
987 | default: | ||
988 | return false; | ||
989 | } | ||
990 | } | ||
991 | |||
992 | static const struct net_device_ops igb_netdev_ops = { | 977 | static const struct net_device_ops igb_netdev_ops = { |
993 | .ndo_open = igb_open, | 978 | .ndo_open = igb_open, |
994 | .ndo_stop = igb_close, | 979 | .ndo_stop = igb_close, |
@@ -1032,17 +1017,8 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1032 | u16 eeprom_data = 0, state = 0; | 1017 | u16 eeprom_data = 0, state = 0; |
1033 | u16 eeprom_apme_mask = IGB_EEPROM_APME; | 1018 | u16 eeprom_apme_mask = IGB_EEPROM_APME; |
1034 | u32 part_num; | 1019 | u32 part_num; |
1035 | int bars, need_ioport; | ||
1036 | 1020 | ||
1037 | /* do not allocate ioport bars when not needed */ | 1021 | err = pci_enable_device_mem(pdev); |
1038 | need_ioport = igb_is_need_ioport(pdev); | ||
1039 | if (need_ioport) { | ||
1040 | bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); | ||
1041 | err = pci_enable_device(pdev); | ||
1042 | } else { | ||
1043 | bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1044 | err = pci_enable_device_mem(pdev); | ||
1045 | } | ||
1046 | if (err) | 1022 | if (err) |
1047 | return err; | 1023 | return err; |
1048 | 1024 | ||
@@ -1085,7 +1061,9 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1085 | break; | 1061 | break; |
1086 | } | 1062 | } |
1087 | 1063 | ||
1088 | err = pci_request_selected_regions(pdev, bars, igb_driver_name); | 1064 | err = pci_request_selected_regions(pdev, pci_select_bars(pdev, |
1065 | IORESOURCE_MEM), | ||
1066 | igb_driver_name); | ||
1089 | if (err) | 1067 | if (err) |
1090 | goto err_pci_reg; | 1068 | goto err_pci_reg; |
1091 | 1069 | ||
@@ -1113,8 +1091,6 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1113 | hw = &adapter->hw; | 1091 | hw = &adapter->hw; |
1114 | hw->back = adapter; | 1092 | hw->back = adapter; |
1115 | adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE; | 1093 | adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE; |
1116 | adapter->bars = bars; | ||
1117 | adapter->need_ioport = need_ioport; | ||
1118 | 1094 | ||
1119 | mmio_start = pci_resource_start(pdev, 0); | 1095 | mmio_start = pci_resource_start(pdev, 0); |
1120 | mmio_len = pci_resource_len(pdev, 0); | 1096 | mmio_len = pci_resource_len(pdev, 0); |
@@ -1361,7 +1337,8 @@ err_hw_init: | |||
1361 | err_ioremap: | 1337 | err_ioremap: |
1362 | free_netdev(netdev); | 1338 | free_netdev(netdev); |
1363 | err_alloc_etherdev: | 1339 | err_alloc_etherdev: |
1364 | pci_release_selected_regions(pdev, bars); | 1340 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
1341 | IORESOURCE_MEM)); | ||
1365 | err_pci_reg: | 1342 | err_pci_reg: |
1366 | err_dma: | 1343 | err_dma: |
1367 | pci_disable_device(pdev); | 1344 | pci_disable_device(pdev); |
@@ -1420,7 +1397,8 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1420 | iounmap(adapter->hw.hw_addr); | 1397 | iounmap(adapter->hw.hw_addr); |
1421 | if (adapter->hw.flash_address) | 1398 | if (adapter->hw.flash_address) |
1422 | iounmap(adapter->hw.flash_address); | 1399 | iounmap(adapter->hw.flash_address); |
1423 | pci_release_selected_regions(pdev, adapter->bars); | 1400 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
1401 | IORESOURCE_MEM)); | ||
1424 | 1402 | ||
1425 | free_netdev(netdev); | 1403 | free_netdev(netdev); |
1426 | 1404 | ||
@@ -4309,10 +4287,7 @@ static int igb_resume(struct pci_dev *pdev) | |||
4309 | pci_set_power_state(pdev, PCI_D0); | 4287 | pci_set_power_state(pdev, PCI_D0); |
4310 | pci_restore_state(pdev); | 4288 | pci_restore_state(pdev); |
4311 | 4289 | ||
4312 | if (adapter->need_ioport) | 4290 | err = pci_enable_device_mem(pdev); |
4313 | err = pci_enable_device(pdev); | ||
4314 | else | ||
4315 | err = pci_enable_device_mem(pdev); | ||
4316 | if (err) { | 4291 | if (err) { |
4317 | dev_err(&pdev->dev, | 4292 | dev_err(&pdev->dev, |
4318 | "igb: Cannot enable PCI device from suspend\n"); | 4293 | "igb: Cannot enable PCI device from suspend\n"); |
@@ -4423,12 +4398,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) | |||
4423 | pci_ers_result_t result; | 4398 | pci_ers_result_t result; |
4424 | int err; | 4399 | int err; |
4425 | 4400 | ||
4426 | if (adapter->need_ioport) | 4401 | if (pci_enable_device_mem(pdev)) { |
4427 | err = pci_enable_device(pdev); | ||
4428 | else | ||
4429 | err = pci_enable_device_mem(pdev); | ||
4430 | |||
4431 | if (err) { | ||
4432 | dev_err(&pdev->dev, | 4402 | dev_err(&pdev->dev, |
4433 | "Cannot re-enable PCI device after reset.\n"); | 4403 | "Cannot re-enable PCI device after reset.\n"); |
4434 | result = PCI_ERS_RESULT_DISCONNECT; | 4404 | result = PCI_ERS_RESULT_DISCONNECT; |