netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shahed Shaikh <shahed.shaikh@qlogic.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <Dept-HSGLinuxNICDev@qlogic.com>,
	Harish Patil <harish.patil@qlogic.com>
Subject: [PATCH net-next 5/7] qlcnic: Enhance semaphore lock access failure error message
Date: Fri, 21 Feb 2014 13:20:14 -0500	[thread overview]
Message-ID: <1393006816-20294-6-git-send-email-shahed.shaikh@qlogic.com> (raw)
In-Reply-To: <1393006816-20294-1-git-send-email-shahed.shaikh@qlogic.com>

From: Harish Patil <harish.patil@qlogic.com>

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 03d18a0..9f3adf4 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -317,9 +317,7 @@ static void qlcnic_write_window_reg(u32 addr, void __iomem *bar0, u32 data)
 int
 qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg)
 {
-	int timeout = 0;
-	int err = 0;
-	u32 done = 0;
+	int timeout = 0, err = 0, done = 0;
 
 	while (!done) {
 		done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem)),
@@ -327,10 +325,20 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg)
 		if (done == 1)
 			break;
 		if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) {
-			dev_err(&adapter->pdev->dev,
-				"Failed to acquire sem=%d lock; holdby=%d\n",
-				sem,
-				id_reg ? QLCRD32(adapter, id_reg, &err) : -1);
+			if (id_reg) {
+				done = QLCRD32(adapter, id_reg, &err);
+				if (done != -1)
+					dev_err(&adapter->pdev->dev,
+						"Failed to acquire sem=%d lock held by=%d\n",
+						sem, done);
+				else
+					dev_err(&adapter->pdev->dev,
+						"Failed to acquire sem=%d lock",
+						sem);
+			} else {
+				dev_err(&adapter->pdev->dev,
+					"Failed to acquire sem=%d lock", sem);
+			}
 			return -EIO;
 		}
 		msleep(1);
-- 
1.8.1.4

  parent reply	other threads:[~2014-02-21 18:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 18:20 [PATCH net-next 0/7] qlcnic: Re-factoring and enhancements Shahed Shaikh
2014-02-21 18:20 ` [PATCH net-next 1/7] qlcnic: Re-factor firmware minidump template header handling Shahed Shaikh
2014-02-21 18:20 ` [PATCH net-next 2/7] qlcnic: Updates to QLogic application/driver interface for virtual NIC configuration Shahed Shaikh
2014-02-21 18:20 ` [PATCH net-next 3/7] qlcnic: Enhance driver message in failed state Shahed Shaikh
2014-02-21 18:20 ` [PATCH net-next 4/7] qlcnic: Allow vlan0 traffic Shahed Shaikh
2014-02-21 18:20 ` Shahed Shaikh [this message]
2014-02-21 18:20 ` [PATCH net-next 6/7] qlcnic: Update version to 5.3.56 Shahed Shaikh
2014-02-21 18:20 ` [PATCH net-next 7/7] Update MAINTAINERS for qlcnic driver Shahed Shaikh
2014-02-24 23:45 ` [PATCH net-next 0/7] qlcnic: Re-factoring and enhancements 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=1393006816-20294-6-git-send-email-shahed.shaikh@qlogic.com \
    --to=shahed.shaikh@qlogic.com \
    --cc=Dept-HSGLinuxNICDev@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=harish.patil@qlogic.com \
    --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).