diff options
author | Michael Chan <mchan@broadcom.com> | 2010-10-13 10:06:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-14 13:45:52 -0400 |
commit | 6e0dc64384298b29ac17de7362b7d6d2ef588304 (patch) | |
tree | efb5e07ff94ea9ad02e85586078cb442a43e4498 | |
parent | f20ce779bb31a90985b0daea2bf0aaf009d21b81 (diff) |
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 27449bf775e3..0fab7203ffbd 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -3428,11 +3428,24 @@ static void cnic_free_irq(struct cnic_dev *dev) | |||
3428 | 3428 | ||
3429 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { | 3429 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { |
3430 | cp->disable_int_sync(dev); | 3430 | cp->disable_int_sync(dev); |
3431 | tasklet_disable(&cp->cnic_irq_task); | 3431 | tasklet_kill(&cp->cnic_irq_task); |
3432 | free_irq(ethdev->irq_arr[0].vector, dev); | 3432 | free_irq(ethdev->irq_arr[0].vector, dev); |
3433 | } | 3433 | } |
3434 | } | 3434 | } |
3435 | 3435 | ||
3436 | static int cnic_request_irq(struct cnic_dev *dev) | ||
3437 | { | ||
3438 | struct cnic_local *cp = dev->cnic_priv; | ||
3439 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
3440 | int err; | ||
3441 | |||
3442 | err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, "cnic", dev); | ||
3443 | if (err) | ||
3444 | tasklet_disable(&cp->cnic_irq_task); | ||
3445 | |||
3446 | return err; | ||
3447 | } | ||
3448 | |||
3436 | static int cnic_init_bnx2_irq(struct cnic_dev *dev) | 3449 | static int cnic_init_bnx2_irq(struct cnic_dev *dev) |
3437 | { | 3450 | { |
3438 | struct cnic_local *cp = dev->cnic_priv; | 3451 | struct cnic_local *cp = dev->cnic_priv; |
@@ -3453,12 +3466,10 @@ static int cnic_init_bnx2_irq(struct cnic_dev *dev) | |||
3453 | cp->last_status_idx = cp->status_blk.bnx2->status_idx; | 3466 | cp->last_status_idx = cp->status_blk.bnx2->status_idx; |
3454 | tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2_msix, | 3467 | tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2_msix, |
3455 | (unsigned long) dev); | 3468 | (unsigned long) dev); |
3456 | err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, | 3469 | err = cnic_request_irq(dev); |
3457 | "cnic", dev); | 3470 | if (err) |
3458 | if (err) { | ||
3459 | tasklet_disable(&cp->cnic_irq_task); | ||
3460 | return err; | 3471 | return err; |
3461 | } | 3472 | |
3462 | while (cp->status_blk.bnx2->status_completion_producer_index && | 3473 | while (cp->status_blk.bnx2->status_completion_producer_index && |
3463 | i < 10) { | 3474 | i < 10) { |
3464 | CNIC_WR(dev, BNX2_HC_COALESCE_NOW, | 3475 | CNIC_WR(dev, BNX2_HC_COALESCE_NOW, |
@@ -3860,12 +3871,9 @@ static int cnic_init_bnx2x_irq(struct cnic_dev *dev) | |||
3860 | 3871 | ||
3861 | tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2x_bh, | 3872 | tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2x_bh, |
3862 | (unsigned long) dev); | 3873 | (unsigned long) dev); |
3863 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { | 3874 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) |
3864 | err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, | 3875 | err = cnic_request_irq(dev); |
3865 | "cnic", dev); | 3876 | |
3866 | if (err) | ||
3867 | tasklet_disable(&cp->cnic_irq_task); | ||
3868 | } | ||
3869 | return err; | 3877 | return err; |
3870 | } | 3878 | } |
3871 | 3879 | ||