wlcore/wl12xx/wl18xx: make NVS file optional for wl18xx
authorArik Nemtsov <arik@wizery.com>
Tue, 29 May 2012 15:38:05 +0000 (18:38 +0300)
committerLuciano Coelho <coelho@ti.com>
Fri, 8 Jun 2012 06:52:06 +0000 (09:52 +0300)
Don't spew errors when we can't find the NVS file in wlcore. Instead
fail the wl12xx boot HW op if the NVS isn't found.

Take this opportunity to remove some dead code from register_hw()
which looks for the NVS again needlessly.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wlcore/boot.c
drivers/net/wireless/ti/wlcore/main.c

index ed718f7ddcce1defb8266f71c3174f6a3777c12e..0fda500c01c95f6dd9e92b9eafa7850647bbda18 100644 (file)
@@ -211,8 +211,10 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
        u32 dest_addr, val;
        u8 *nvs_ptr, *nvs_aligned;
 
-       if (wl->nvs == NULL)
+       if (wl->nvs == NULL) {
+               wl1271_error("NVS file is needed during boot");
                return -ENODEV;
+       }
 
        if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) {
                struct wl1271_nvs_file *nvs =
index 176a3117889b0cf85aa1c5e4bcb068eab25d5c22..1156e3f578c122afcbeaa80d9a31c32e94705026 100644 (file)
@@ -715,7 +715,7 @@ out:
        return ret;
 }
 
-static int wl1271_fetch_nvs(struct wl1271 *wl)
+static void wl1271_fetch_nvs(struct wl1271 *wl)
 {
        const struct firmware *fw;
        int ret;
@@ -723,16 +723,15 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
        ret = request_firmware(&fw, WL12XX_NVS_NAME, wl->dev);
 
        if (ret < 0) {
-               wl1271_error("could not get nvs file %s: %d", WL12XX_NVS_NAME,
-                            ret);
-               return ret;
+               wl1271_debug(DEBUG_BOOT, "could not get nvs file %s: %d",
+                            WL12XX_NVS_NAME, ret);
+               return;
        }
 
        wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL);
 
        if (!wl->nvs) {
                wl1271_error("could not allocate memory for the nvs file");
-               ret = -ENOMEM;
                goto out;
        }
 
@@ -740,8 +739,6 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
 
 out:
        release_firmware(fw);
-
-       return ret;
 }
 
 void wl12xx_queue_recovery_work(struct wl1271 *wl)
@@ -989,13 +986,6 @@ static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt)
        if (ret < 0)
                goto out;
 
-       /* No NVS from netlink, try to get it from the filesystem */
-       if (wl->nvs == NULL) {
-               ret = wl1271_fetch_nvs(wl);
-               if (ret < 0)
-                       goto out;
-       }
-
 out:
        return ret;
 }
@@ -4937,8 +4927,8 @@ static int wl1271_register_hw(struct wl1271 *wl)
        if (wl->mac80211_registered)
                return 0;
 
-       ret = wl1271_fetch_nvs(wl);
-       if (ret == 0) {
+       wl1271_fetch_nvs(wl);
+       if (wl->nvs != NULL) {
                /* NOTE: The wl->nvs->nvs element must be first, in
                 * order to simplify the casting, we assume it is at
                 * the beginning of the wl->nvs structure.