diff options
author | Michael Chan <mchan@broadcom.com> | 2010-10-13 14:06:44 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-14 10:45:52 -0700 |
commit | 6e0dc64384298b29ac17de7362b7d6d2ef588304 (patch) | |
tree | efb5e07ff94ea9ad02e85586078cb442a43e4498 | |
parent | f20ce779bb31a90985b0daea2bf0aaf009d21b81 (diff) | |
download | op-kernel-dev-6e0dc64384298b29ac17de7362b7d6d2ef588304.zip op-kernel-dev-6e0dc64384298b29ac17de7362b7d6d2ef588304.tar.gz |
cnic: Add common cnic_request_irq()
to reduce some duplicate code. Also, use tasklet_kill() in
cnic_free_irq() to wait for the cnic_irq_task to complete.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/cnic.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 27449bf..0fab720 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c @@ -3428,11 +3428,24 @@ static void cnic_free_irq(struct cnic_dev *dev) if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { cp->disable_int_sync(dev); - tasklet_disable(&cp->cnic_irq_task); + tasklet_kill(&cp->cnic_irq_task); free_irq(ethdev->irq_arr[0].vector, dev); } } +static int cnic_request_irq(struct cnic_dev *dev) +{ + struct cnic_local *cp = dev->cnic_priv; + struct cnic_eth_dev *ethdev = cp->ethdev; + int err; + + err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, "cnic", dev); + if (err) + tasklet_disable(&cp->cnic_irq_task); + + return err; +} + static int cnic_init_bnx2_irq(struct cnic_dev *dev) { struct cnic_local *cp = dev->cnic_priv; @@ -3453,12 +3466,10 @@ static int cnic_init_bnx2_irq(struct cnic_dev *dev) cp->last_status_idx = cp->status_blk.bnx2->status_idx; tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2_msix, (unsigned long) dev); - err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, - "cnic", dev); - if (err) { - tasklet_disable(&cp->cnic_irq_task); + err = cnic_request_irq(dev); + if (err) return err; - } + while (cp->status_blk.bnx2->status_completion_producer_index && i < 10) { CNIC_WR(dev, BNX2_HC_COALESCE_NOW, @@ -3860,12 +3871,9 @@ static int cnic_init_bnx2x_irq(struct cnic_dev *dev) tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2x_bh, (unsigned long) dev); - if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { - err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, - "cnic", dev); - if (err) - tasklet_disable(&cp->cnic_irq_task); - } + if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) + err = cnic_request_irq(dev); + return err; } |