aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-05-17 18:29:07 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-17 20:43:15 -0400
commitfb136c070bfdde11dc79758674f54fb26bba1a2f (patch)
tree3210ac72ce77727fe99e0365a26ad3fe64d7fde4 /drivers/net
parent4a79a04e4c0aa06b556b7d52bfb31c05fbb05616 (diff)
ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak
pci_enable_msi calls can fail for normal operational reasons. Driver should not print an error message in that case. Fix a leak that leaves msi enabled if pci_request_irq fails. We can remove CONFIG_PCI_MSI ifdefs alltogether Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ixgb/ixgb.h2
-rw-r--r--drivers/net/ixgb/ixgb_main.c36
2 files changed, 15 insertions, 23 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index c8e90861f869..3569d5b03388 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -193,8 +193,6 @@ struct ixgb_adapter {
193 u16 msg_enable; 193 u16 msg_enable;
194 struct ixgb_hw_stats stats; 194 struct ixgb_hw_stats stats;
195 uint32_t alloc_rx_buff_failed; 195 uint32_t alloc_rx_buff_failed;
196#ifdef CONFIG_PCI_MSI
197 boolean_t have_msi; 196 boolean_t have_msi;
198#endif
199}; 197};
200#endif /* _IXGB_H_ */ 198#endif /* _IXGB_H_ */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 6d2b059371f1..991c8833e23c 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -227,7 +227,7 @@ int
227ixgb_up(struct ixgb_adapter *adapter) 227ixgb_up(struct ixgb_adapter *adapter)
228{ 228{
229 struct net_device *netdev = adapter->netdev; 229 struct net_device *netdev = adapter->netdev;
230 int err; 230 int err, irq_flags = IRQF_SHARED;
231 int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; 231 int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
232 struct ixgb_hw *hw = &adapter->hw; 232 struct ixgb_hw *hw = &adapter->hw;
233 233
@@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter)
246 /* disable interrupts and get the hardware into a known state */ 246 /* disable interrupts and get the hardware into a known state */
247 IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff); 247 IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
248 248
249#ifdef CONFIG_PCI_MSI 249 /* only enable MSI if bus is in PCI-X mode */
250 { 250 if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
251 boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) & 251 err = pci_enable_msi(adapter->pdev);
252 IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE; 252 if (!err) {
253 adapter->have_msi = TRUE; 253 adapter->have_msi = 1;
254 254 irq_flags = 0;
255 if (!pcix) 255 }
256 adapter->have_msi = FALSE;
257 else if((err = pci_enable_msi(adapter->pdev))) {
258 DPRINTK(PROBE, ERR,
259 "Unable to allocate MSI interrupt Error: %d\n", err);
260 adapter->have_msi = FALSE;
261 /* proceed to try to request regular interrupt */ 256 /* proceed to try to request regular interrupt */
262 } 257 }
263 }
264 258
265#endif 259 err = request_irq(adapter->pdev->irq, &ixgb_intr, irq_flags,
266 if((err = request_irq(adapter->pdev->irq, &ixgb_intr, 260 netdev->name, netdev);
267 IRQF_SHARED | IRQF_SAMPLE_RANDOM, 261 if (err) {
268 netdev->name, netdev))) { 262 if (adapter->have_msi)
263 pci_disable_msi(adapter->pdev);
269 DPRINTK(PROBE, ERR, 264 DPRINTK(PROBE, ERR,
270 "Unable to allocate interrupt Error: %d\n", err); 265 "Unable to allocate interrupt Error: %d\n", err);
271 return err; 266 return err;
@@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
307 302
308 ixgb_irq_disable(adapter); 303 ixgb_irq_disable(adapter);
309 free_irq(adapter->pdev->irq, netdev); 304 free_irq(adapter->pdev->irq, netdev);
310#ifdef CONFIG_PCI_MSI 305
311 if(adapter->have_msi == TRUE) 306 if (adapter->have_msi)
312 pci_disable_msi(adapter->pdev); 307 pci_disable_msi(adapter->pdev);
313 308
314#endif
315 if(kill_watchdog) 309 if(kill_watchdog)
316 del_timer_sync(&adapter->watchdog_timer); 310 del_timer_sync(&adapter->watchdog_timer);
317#ifdef CONFIG_IXGB_NAPI 311#ifdef CONFIG_IXGB_NAPI