BNX2X: spatch pci/irq tidbits
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 9 Feb 2015 23:03:07 +0000 (18:03 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 Mar 2015 16:59:09 +0000 (11:59 -0500)
I manually edited the result of register_irq()'s transformation.  Note
the comment in the cocci.

Also, this version of spatch (different machine than some other
spatches) caught a net_device in bnx2x that was missed earlier.

kern/drivers/net/bnx2x/bnx2x.h
kern/drivers/net/bnx2x/bnx2x_cmn.c
kern/drivers/net/bnx2x/bnx2x_main.c
scripts/spatch/linux/funcs.cocci
scripts/spatch/linux/scalar.cocci

index dc107cc..32f5424 100644 (file)
@@ -1609,7 +1609,7 @@ struct bnx2x {
        uint8_t                 cnic_support;
        bool                    cnic_enabled;
        bool                    cnic_loaded;
-       struct cnic_eth_dev     *(*cnic_probe)(struct net_device *);
+       struct cnic_eth_dev     *(*cnic_probe)(struct ether *);
 
        /* Flag that indicates that we can start looking for FCoE L2 queue
         * completions in the default status block.
index e655a54..7eff801 100644 (file)
@@ -1730,9 +1730,9 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
 
        /* no default status block for vf */
        if (IS_PF(bp)) {
-               rc = request_irq(bp->msix_table[offset++].vector,
-                                bnx2x_msix_sp_int, 0,
-                                bp->dev->name, bp->dev);
+               rc = register_irq(bp->msix_table[offset++].vector,
+                                 bnx2x_msix_sp_int, bp->dev,
+                                 pci_to_tbdf(bp->pdev));
                if (rc) {
                        BNX2X_ERR("request sp irq failed\n");
                        return -EBUSY;
@@ -1747,8 +1747,8 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
                snprintf(fp->name, sizeof(fp->name), "%s-fp-%d",
                         bp->dev->name, i);
 
-               rc = request_irq(bp->msix_table[offset].vector,
-                                bnx2x_msix_fp_int, 0, fp->name, fp);
+               rc = register_irq(bp->msix_table[offset].vector,
+                                 bnx2x_msix_fp_int, fp, pci_to_tbdf(bp->pdev));
                if (rc) {
                        BNX2X_ERR("request fp #%d irq (%d) failed  rc %d\n", i,
                              bp->msix_table[offset].vector, rc);
@@ -1806,7 +1806,8 @@ static int bnx2x_req_irq(struct bnx2x *bp)
        else
                irq = bp->pdev->irq;
 
-       return request_irq(irq, bnx2x_interrupt, flags, bp->dev->name, bp->dev);
+       return register_irq(irq, bnx2x_interrupt, bp->dev,
+                           pci_to_tbdf(bp->pdev));
 }
 
 static int bnx2x_setup_irqs(struct bnx2x *bp)
index 3227fbe..a15fb7b 100644 (file)
@@ -1658,7 +1658,7 @@ void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
                for_each_eth_queue(bp, i)
                        synchronize_irq(bp->msix_table[offset++].vector);
        } else
-               synchronize_irq(bp->pdev->irq);
+               synchronize_irq(bp->pdev->irqline);
 
        /* make sure sp_task is not running */
        cancel_delayed_work(&bp->sp_task);
@@ -9074,7 +9074,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp)
        if (msix)
                synchronize_irq(bp->msix_table[0].vector);
        else
-               synchronize_irq(bp->pdev->irq);
+               synchronize_irq(bp->pdev->irqline);
 
        flush_workqueue(bnx2x_wq);
        flush_workqueue(bnx2x_iov_wq);
@@ -12665,7 +12665,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_device *pdev,
        dev->base_addr = dev->mem_start;
        dev->mem_end = pci_resource_end(pdev, 0);
 
-       dev->irq = pdev->irq;
+       dev->irq = pdev->irqline;
 
        bp->regview = pci_ioremap_bar(pdev, 0);
        if (!bp->regview) {
@@ -13491,7 +13491,7 @@ static int bnx2x_init_one(struct pci_device *pdev,
                       pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" :
                       pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" :
                       "Unknown",
-                      dev->base_addr, bp->pdev->irq, dev->dev_addr);
+                      dev->base_addr, bp->pdev->irqline, dev->dev_addr);
 
        bnx2x_register_phc(bp);
 
index 72b2b3c..7659179 100644 (file)
@@ -185,3 +185,16 @@ expression E;
 @@
 -smp_processor_id()
 +core_id()
+
+// This is a little half-assed.  Any fix will need to be manually edited to
+// provide a pointer to the pci device.  And you'll need to fix your handler to
+// be the correct type.
+@@
+expression IRQ;
+expression HANDLER;
+expression FLAGS;
+expression NAME;
+expression ARG;
+@@
+-request_irq(IRQ, HANDLER, FLAGS, NAME, ARG)
++register_irq(IRQ, HANDLER, ARG, pci_to_tbdf(PCIDEV))
index 61a7c3d..fd701e4 100644 (file)
@@ -81,3 +81,9 @@ typedef uint;
  struct
 -net_device
 +ether
+
+@@
+struct pci_device *p;
+@@
+-p->irq
++p->irqline