diff options
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 637ae8f68791..49be393e1c1d 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -158,9 +158,7 @@ static struct net_device_stats * e1000_get_stats(struct net_device *netdev); | |||
158 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); | 158 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); |
159 | static int e1000_set_mac(struct net_device *netdev, void *p); | 159 | static int e1000_set_mac(struct net_device *netdev, void *p); |
160 | static irqreturn_t e1000_intr(int irq, void *data); | 160 | static irqreturn_t e1000_intr(int irq, void *data); |
161 | #ifdef CONFIG_PCI_MSI | ||
162 | static irqreturn_t e1000_intr_msi(int irq, void *data); | 161 | static irqreturn_t e1000_intr_msi(int irq, void *data); |
163 | #endif | ||
164 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter, | 162 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter, |
165 | struct e1000_tx_ring *tx_ring); | 163 | struct e1000_tx_ring *tx_ring); |
166 | #ifdef CONFIG_E1000_NAPI | 164 | #ifdef CONFIG_E1000_NAPI |
@@ -300,31 +298,26 @@ module_exit(e1000_exit_module); | |||
300 | static int e1000_request_irq(struct e1000_adapter *adapter) | 298 | static int e1000_request_irq(struct e1000_adapter *adapter) |
301 | { | 299 | { |
302 | struct net_device *netdev = adapter->netdev; | 300 | struct net_device *netdev = adapter->netdev; |
303 | int flags, err = 0; | 301 | void (*handler) = &e1000_intr; |
302 | int irq_flags = IRQF_SHARED; | ||
303 | int err; | ||
304 | 304 | ||
305 | flags = IRQF_SHARED; | ||
306 | #ifdef CONFIG_PCI_MSI | ||
307 | if (adapter->hw.mac_type >= e1000_82571) { | 305 | if (adapter->hw.mac_type >= e1000_82571) { |
308 | adapter->have_msi = TRUE; | 306 | adapter->have_msi = !pci_enable_msi(adapter->pdev); |
309 | if ((err = pci_enable_msi(adapter->pdev))) { | 307 | if (adapter->have_msi) { |
310 | DPRINTK(PROBE, ERR, | 308 | handler = &e1000_intr_msi; |
311 | "Unable to allocate MSI interrupt Error: %d\n", err); | 309 | irq_flags = 0; |
312 | adapter->have_msi = FALSE; | ||
313 | } | 310 | } |
314 | } | 311 | } |
315 | if (adapter->have_msi) { | 312 | |
316 | flags &= ~IRQF_SHARED; | 313 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, |
317 | err = request_irq(adapter->pdev->irq, &e1000_intr_msi, flags, | 314 | netdev); |
318 | netdev->name, netdev); | 315 | if (err) { |
319 | if (err) | 316 | if (adapter->have_msi) |
320 | DPRINTK(PROBE, ERR, | 317 | pci_disable_msi(adapter->pdev); |
321 | "Unable to allocate interrupt Error: %d\n", err); | ||
322 | } else | ||
323 | #endif | ||
324 | if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags, | ||
325 | netdev->name, netdev))) | ||
326 | DPRINTK(PROBE, ERR, | 318 | DPRINTK(PROBE, ERR, |
327 | "Unable to allocate interrupt Error: %d\n", err); | 319 | "Unable to allocate interrupt Error: %d\n", err); |
320 | } | ||
328 | 321 | ||
329 | return err; | 322 | return err; |
330 | } | 323 | } |
@@ -335,10 +328,8 @@ static void e1000_free_irq(struct e1000_adapter *adapter) | |||
335 | 328 | ||
336 | free_irq(adapter->pdev->irq, netdev); | 329 | free_irq(adapter->pdev->irq, netdev); |
337 | 330 | ||
338 | #ifdef CONFIG_PCI_MSI | ||
339 | if (adapter->have_msi) | 331 | if (adapter->have_msi) |
340 | pci_disable_msi(adapter->pdev); | 332 | pci_disable_msi(adapter->pdev); |
341 | #endif | ||
342 | } | 333 | } |
343 | 334 | ||
344 | /** | 335 | /** |
@@ -3744,7 +3735,6 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3744 | 3735 | ||
3745 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 3736 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
3746 | } | 3737 | } |
3747 | #ifdef CONFIG_PCI_MSI | ||
3748 | 3738 | ||
3749 | /** | 3739 | /** |
3750 | * e1000_intr_msi - Interrupt Handler | 3740 | * e1000_intr_msi - Interrupt Handler |
@@ -3810,7 +3800,6 @@ e1000_intr_msi(int irq, void *data) | |||
3810 | 3800 | ||
3811 | return IRQ_HANDLED; | 3801 | return IRQ_HANDLED; |
3812 | } | 3802 | } |
3813 | #endif | ||
3814 | 3803 | ||
3815 | /** | 3804 | /** |
3816 | * e1000_intr - Interrupt Handler | 3805 | * e1000_intr - Interrupt Handler |