brcmfmac: only show error message when brcmf_sdiod_regrw_helper() fails
authorArend van Spriel <arend@broadcom.com>
Thu, 20 Mar 2014 09:18:02 +0000 (10:18 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 20 Mar 2014 15:55:40 +0000 (11:55 -0400)
In the function brcmf_sdiod_request_data() an error message is logged,
but the calling function retries it. This patch will only log an error
message when retry limit is reached. The low-level error is still
logged by a SDIO debug message.

Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c

index 6e8718bf69209cad1886319d7694b3faa53c6c9c..a16e644e7c08826fed5c6d75a6413b8ff5959bdd 100644 (file)
@@ -269,26 +269,17 @@ static int brcmf_sdiod_request_data(struct brcmf_sdio_dev *sdiodev, u8 fn,
                break;
        }
 
-       if (ret) {
-               /*
-                * SleepCSR register access can fail when
-                * waking up the device so reduce this noise
-                * in the logs.
-                */
-               if (addr != SBSDIO_FUNC1_SLEEPCSR)
-                       brcmf_err("failed to %s data F%d@0x%05x, err: %d\n",
-                                 write ? "write" : "read", fn, addr, ret);
-               else
-                       brcmf_dbg(SDIO, "failed to %s data F%d@0x%05x, err: %d\n",
-                                 write ? "write" : "read", fn, addr, ret);
-       }
+       if (ret)
+               brcmf_dbg(SDIO, "failed to %s data F%d@0x%05x, err: %d\n",
+                         write ? "write" : "read", fn, addr, ret);
+
        return ret;
 }
 
 static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
                                   u8 regsz, void *data, bool write)
 {
-       u8 func_num;
+       u8 func;
        s32 retry = 0;
        int ret;
 
@@ -302,9 +293,9 @@ static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
         * The rest: function 1 silicon backplane core registers
         */
        if ((addr & ~REG_F0_REG_MASK) == 0)
-               func_num = SDIO_FUNC_0;
+               func = SDIO_FUNC_0;
        else
-               func_num = SDIO_FUNC_1;
+               func = SDIO_FUNC_1;
 
        do {
                if (!write)
@@ -312,16 +303,26 @@ static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
                /* for retry wait for 1 ms till bus get settled down */
                if (retry)
                        usleep_range(1000, 2000);
-               ret = brcmf_sdiod_request_data(sdiodev, func_num, addr, regsz,
+               ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz,
                                               data, write);
        } while (ret != 0 && ret != -ENOMEDIUM &&
                 retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
 
        if (ret == -ENOMEDIUM)
                brcmf_bus_change_state(sdiodev->bus_if, BRCMF_BUS_NOMEDIUM);
-       else if (ret != 0)
-               brcmf_err("failed with %d\n", ret);
-
+       else if (ret != 0) {
+               /*
+                * SleepCSR register access can fail when
+                * waking up the device so reduce this noise
+                * in the logs.
+                */
+               if (addr != SBSDIO_FUNC1_SLEEPCSR)
+                       brcmf_err("failed to %s data F%d@0x%05x, err: %d\n",
+                                 write ? "write" : "read", func, addr, ret);
+               else
+                       brcmf_dbg(SDIO, "failed to %s data F%d@0x%05x, err: %d\n",
+                                 write ? "write" : "read", func, addr, ret);
+       }
        return ret;
 }