qlcnic: Enhance semaphore lock access failure error message
authorHarish Patil <harish.patil@qlogic.com>
Fri, 21 Feb 2014 18:20:14 +0000 (13:20 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Feb 2014 23:43:19 +0000 (18:43 -0500)
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c

index 03d18a0be6ce98cd8ab517d9623983de22a99672..9f3adf4e70b5f31a2d143c8d946ce6d88201a096 100644 (file)
@@ -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);