Hi,
This proof-of-concept patch converts the e1000 driver to use the
pci_request_irq() function.
Please note that I'm not submitting the driver changes, they're there
only for illustration purposes. I'll CC the appropriate maintainers
when/if an API is agreed upon.
Regards,
Frederik
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 778ede3..8b7be73 100644
drivers/net/e1000/e1000_ethtool.c | 11 +++++------
drivers/net/e1000/e1000_main.c | 15 +++------------
2 files changed, 8 insertions(+), 18 deletions(-)
Index: 2.6.18-mm3/drivers/net/e1000/e1000_ethtool.c
===================================================================
--- 2.6.18-mm3.orig/drivers/net/e1000/e1000_ethtool.c
+++ 2.6.18-mm3/drivers/net/e1000/e1000_ethtool.c
@@ -899,17 +899,16 @@ e1000_intr_test(struct e1000_adapter *ad
{
struct net_device *netdev = adapter->netdev;
uint32_t mask, i=0, shared_int = TRUE;
- uint32_t irq = adapter->pdev->irq;
*data = 0;
/* NOTE: we don't test MSI interrupts here, yet */
/* Hook up test interrupt handler just for this test */
- if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED,
- netdev->name, netdev))
+ if (!pci_request_irq(adapter->pdev, &e1000_test_intr, IRQF_PROBE_SHARED,
+ netdev->name))
shared_int = FALSE;
- else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED,
- netdev->name, netdev)) {
+ else if (pci_request_irq(adapter->pdev, &e1000_test_intr, 0,
+ netdev->name)) {
*data = 1;
return -1;
}
@@ -986,7 +985,7 @@ e1000_intr_test(struct e1000_adapter *ad
msleep(10);
/* Unhook test interrupt handler */
- free_irq(irq, netdev);
+ pci_free_irq(adapter->pdev);
return *data;
}
Index: 2.6.18-mm3/drivers/net/e1000/e1000_main.c
===================================================================
--- 2.6.18-mm3.orig/drivers/net/e1000/e1000_main.c
+++ 2.6.18-mm3/drivers/net/e1000/e1000_main.c
@@ -281,9 +281,8 @@ module_exit(e1000_exit_module);
static int e1000_request_irq(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
- int flags, err = 0;
+ int err = 0;
- flags = IRQF_SHARED;
#ifdef CONFIG_PCI_MSI
if (adapter->hw.mac_type > e1000_82547_rev_2) {
adapter->have_msi = TRUE;
@@ -293,22 +292,14 @@ static int e1000_request_irq(struct e100
adapter->have_msi = FALSE;
}
}
- if (adapter->have_msi)
- flags &= ~IRQF_SHARED;
#endif
- if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags,
- netdev->name, netdev)))
- DPRINTK(PROBE, ERR,
- "Unable to allocate interrupt Error: %d\n", err);
-
+ err = pci_request_irq(adapter->pdev, &e1000_intr, 0, netdev->name);
return err;
}
static void e1000_free_irq(struct e1000_adapter *adapter)
{
- struct net_device *netdev = adapter->netdev;
-
- free_irq(adapter->pdev->irq, netdev);
+ pci_free_irq(adapter->pdev);
#ifdef CONFIG_PCI_MSI
if (adapter->have_msi)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]