From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/8 net-next] cnic: Add common cnic_request_irq()
Date: Wed, 13 Oct 2010 17:06:44 -0700 [thread overview]
Message-ID: <1287014811-10979-2-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1287014811-10979-1-git-send-email-mchan@broadcom.com>
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>
---
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;
}
--
1.6.4.GIT
next prev parent reply other threads:[~2010-10-14 1:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 0:06 [PATCH 0/8 net-next] cnic: Bug fixes and 57712 support Michael Chan
2010-10-14 0:06 ` Michael Chan [this message]
2010-10-14 0:06 ` [PATCH 2/8 net-next] cnic: Convert ctx_flags to bit fields Michael Chan
2010-10-14 0:06 ` [PATCH 3/8 net-next] cnic: Add cnic_bnx2x_destroy_ramrod() Michael Chan
2010-10-14 0:06 ` [PATCH 4/8 net-next] cnic: Defer iscsi connection cleanup Michael Chan
2010-10-14 0:06 ` [PATCH 5/8 net-next] cnic: Add cnic_free_uio() Michael Chan
2010-10-14 0:06 ` [PATCH 6/8 net-next] cnic: Add cnic_uio_dev struct Michael Chan
2010-10-14 0:06 ` [PATCH 7/8 net-next] cnic: Decouple uio close from cnic shutdown Michael Chan
2010-10-14 0:06 ` [PATCH 8/8 net-next] cnic: Add support for 57712 device Michael Chan
2010-10-14 17:46 ` [PATCH 0/8 net-next] cnic: Bug fixes and 57712 support David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287014811-10979-2-git-send-email-mchan@broadcom.com \
--to=mchan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).