aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000e/e1000.h4
-rw-r--r--drivers/net/e1000e/netdev.c48
2 files changed, 10 insertions, 42 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index d3ed1ed6329..cf57050d99d 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -284,10 +284,6 @@ struct e1000_adapter {
284 unsigned long led_status; 284 unsigned long led_status;
285 285
286 unsigned int flags; 286 unsigned int flags;
287
288 /* for ioport free */
289 int bars;
290 int need_ioport;
291}; 287};
292 288
293struct e1000_info { 289struct e1000_info {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 18f076c01ee..05b0b2f9c54 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3991,10 +3991,7 @@ static int e1000_resume(struct pci_dev *pdev)
3991 pci_restore_state(pdev); 3991 pci_restore_state(pdev);
3992 e1000e_disable_l1aspm(pdev); 3992 e1000e_disable_l1aspm(pdev);
3993 3993
3994 if (adapter->need_ioport) 3994 err = pci_enable_device_mem(pdev);
3995 err = pci_enable_device(pdev);
3996 else
3997 err = pci_enable_device_mem(pdev);
3998 if (err) { 3995 if (err) {
3999 dev_err(&pdev->dev, 3996 dev_err(&pdev->dev,
4000 "Cannot enable PCI device from suspend\n"); 3997 "Cannot enable PCI device from suspend\n");
@@ -4096,10 +4093,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
4096 int err; 4093 int err;
4097 4094
4098 e1000e_disable_l1aspm(pdev); 4095 e1000e_disable_l1aspm(pdev);
4099 if (adapter->need_ioport) 4096 err = pci_enable_device_mem(pdev);
4100 err = pci_enable_device(pdev);
4101 else
4102 err = pci_enable_device_mem(pdev);
4103 if (err) { 4097 if (err) {
4104 dev_err(&pdev->dev, 4098 dev_err(&pdev->dev,
4105 "Cannot re-enable PCI device after reset.\n"); 4099 "Cannot re-enable PCI device after reset.\n");
@@ -4197,21 +4191,6 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
4197} 4191}
4198 4192
4199/** 4193/**
4200 * e1000e_is_need_ioport - determine if an adapter needs ioport resources or not
4201 * @pdev: PCI device information struct
4202 *
4203 * Returns true if an adapters needs ioport resources
4204 **/
4205static int e1000e_is_need_ioport(struct pci_dev *pdev)
4206{
4207 switch (pdev->device) {
4208 /* Currently there are no adapters that need ioport resources */
4209 default:
4210 return false;
4211 }
4212}
4213
4214/**
4215 * e1000_probe - Device Initialization Routine 4194 * e1000_probe - Device Initialization Routine
4216 * @pdev: PCI device information struct 4195 * @pdev: PCI device information struct
4217 * @ent: entry in e1000_pci_tbl 4196 * @ent: entry in e1000_pci_tbl
@@ -4236,19 +4215,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4236 int i, err, pci_using_dac; 4215 int i, err, pci_using_dac;
4237 u16 eeprom_data = 0; 4216 u16 eeprom_data = 0;
4238 u16 eeprom_apme_mask = E1000_EEPROM_APME; 4217 u16 eeprom_apme_mask = E1000_EEPROM_APME;
4239 int bars, need_ioport;
4240 4218
4241 e1000e_disable_l1aspm(pdev); 4219 e1000e_disable_l1aspm(pdev);
4242 4220
4243 /* do not allocate ioport bars when not needed */ 4221 err = pci_enable_device_mem(pdev);
4244 need_ioport = e1000e_is_need_ioport(pdev);
4245 if (need_ioport) {
4246 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
4247 err = pci_enable_device(pdev);
4248 } else {
4249 bars = pci_select_bars(pdev, IORESOURCE_MEM);
4250 err = pci_enable_device_mem(pdev);
4251 }
4252 if (err) 4222 if (err)
4253 return err; 4223 return err;
4254 4224
@@ -4271,7 +4241,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4271 } 4241 }
4272 } 4242 }
4273 4243
4274 err = pci_request_selected_regions(pdev, bars, e1000e_driver_name); 4244 err = pci_request_selected_regions(pdev,
4245 pci_select_bars(pdev, IORESOURCE_MEM),
4246 e1000e_driver_name);
4275 if (err) 4247 if (err)
4276 goto err_pci_reg; 4248 goto err_pci_reg;
4277 4249
@@ -4296,8 +4268,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4296 adapter->hw.adapter = adapter; 4268 adapter->hw.adapter = adapter;
4297 adapter->hw.mac.type = ei->mac; 4269 adapter->hw.mac.type = ei->mac;
4298 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; 4270 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
4299 adapter->bars = bars;
4300 adapter->need_ioport = need_ioport;
4301 4271
4302 mmio_start = pci_resource_start(pdev, 0); 4272 mmio_start = pci_resource_start(pdev, 0);
4303 mmio_len = pci_resource_len(pdev, 0); 4273 mmio_len = pci_resource_len(pdev, 0);
@@ -4536,7 +4506,8 @@ err_flashmap:
4536err_ioremap: 4506err_ioremap:
4537 free_netdev(netdev); 4507 free_netdev(netdev);
4538err_alloc_etherdev: 4508err_alloc_etherdev:
4539 pci_release_selected_regions(pdev, bars); 4509 pci_release_selected_regions(pdev,
4510 pci_select_bars(pdev, IORESOURCE_MEM));
4540err_pci_reg: 4511err_pci_reg:
4541err_dma: 4512err_dma:
4542 pci_disable_device(pdev); 4513 pci_disable_device(pdev);
@@ -4584,7 +4555,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4584 iounmap(adapter->hw.hw_addr); 4555 iounmap(adapter->hw.hw_addr);
4585 if (adapter->hw.flash_address) 4556 if (adapter->hw.flash_address)
4586 iounmap(adapter->hw.flash_address); 4557 iounmap(adapter->hw.flash_address);
4587 pci_release_selected_regions(pdev, adapter->bars); 4558 pci_release_selected_regions(pdev,
4559 pci_select_bars(pdev, IORESOURCE_MEM));
4588 4560
4589 free_netdev(netdev); 4561 free_netdev(netdev);
4590 4562