* [PATCH] ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak
@ 2007-05-17 22:29 Auke Kok
2007-05-18 0:46 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Auke Kok @ 2007-05-17 22:29 UTC (permalink / raw)
To: jeff
Cc: netdev, e1000-devel, jesse.brandeburg, john.ronciak,
jeffrey.t.kirsher, cebbert, hpa
From: Auke Kok <auke-jan.h.kok@intel.com>
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>
---
drivers/net/ixgb/ixgb.h | 2 --
drivers/net/ixgb/ixgb_main.c | 36 +++++++++++++++---------------------
2 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index c8e9086..3569d5b 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -193,8 +193,6 @@ struct ixgb_adapter {
u16 msg_enable;
struct ixgb_hw_stats stats;
uint32_t alloc_rx_buff_failed;
-#ifdef CONFIG_PCI_MSI
boolean_t have_msi;
-#endif
};
#endif /* _IXGB_H_ */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 6d2b059..991c883 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -227,7 +227,7 @@ int
ixgb_up(struct ixgb_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
- int err;
+ int err, irq_flags = IRQF_SHARED;
int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
struct ixgb_hw *hw = &adapter->hw;
@@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter)
/* disable interrupts and get the hardware into a known state */
IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
-#ifdef CONFIG_PCI_MSI
- {
- boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) &
- IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE;
- adapter->have_msi = TRUE;
-
- if (!pcix)
- adapter->have_msi = FALSE;
- else if((err = pci_enable_msi(adapter->pdev))) {
- DPRINTK(PROBE, ERR,
- "Unable to allocate MSI interrupt Error: %d\n", err);
- adapter->have_msi = FALSE;
+ /* only enable MSI if bus is in PCI-X mode */
+ if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
+ err = pci_enable_msi(adapter->pdev);
+ if (!err) {
+ adapter->have_msi = 1;
+ irq_flags = 0;
+ }
/* proceed to try to request regular interrupt */
}
- }
-#endif
- if((err = request_irq(adapter->pdev->irq, &ixgb_intr,
- IRQF_SHARED | IRQF_SAMPLE_RANDOM,
- netdev->name, netdev))) {
+ err = request_irq(adapter->pdev->irq, &ixgb_intr, irq_flags,
+ netdev->name, netdev);
+ if (err) {
+ if (adapter->have_msi)
+ pci_disable_msi(adapter->pdev);
DPRINTK(PROBE, ERR,
"Unable to allocate interrupt Error: %d\n", err);
return err;
@@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
ixgb_irq_disable(adapter);
free_irq(adapter->pdev->irq, netdev);
-#ifdef CONFIG_PCI_MSI
- if(adapter->have_msi == TRUE)
+
+ if (adapter->have_msi)
pci_disable_msi(adapter->pdev);
-#endif
if(kill_watchdog)
del_timer_sync(&adapter->watchdog_timer);
#ifdef CONFIG_IXGB_NAPI
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak
2007-05-17 22:29 [PATCH] ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak Auke Kok
@ 2007-05-18 0:46 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-05-18 0:46 UTC (permalink / raw)
To: Auke Kok
Cc: netdev, e1000-devel, jesse.brandeburg, john.ronciak,
jeffrey.t.kirsher, cebbert, hpa
Auke Kok wrote:
> From: Auke Kok <auke-jan.h.kok@intel.com>
>
> 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>
> ---
>
> drivers/net/ixgb/ixgb.h | 2 --
> drivers/net/ixgb/ixgb_main.c | 36 +++++++++++++++---------------------
> 2 files changed, 15 insertions(+), 23 deletions(-)
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-18 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-17 22:29 [PATCH] ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak Auke Kok
2007-05-18 0:46 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).