wlcore/wl12xx/wl18xx: make NVS file optional for wl18xx

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>
This commit is contained in:
Arik Nemtsov 2012-05-29 18:38:05 +03:00 committed by Luciano Coelho
parent 17d97719dc
commit 3e3947fffc
2 changed files with 9 additions and 17 deletions

View file

@ -211,8 +211,10 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
u32 dest_addr, val; u32 dest_addr, val;
u8 *nvs_ptr, *nvs_aligned; u8 *nvs_ptr, *nvs_aligned;
if (wl->nvs == NULL) if (wl->nvs == NULL) {
wl1271_error("NVS file is needed during boot");
return -ENODEV; return -ENODEV;
}
if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) { if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) {
struct wl1271_nvs_file *nvs = struct wl1271_nvs_file *nvs =

View file

@ -715,7 +715,7 @@ static int wl12xx_fetch_firmware(struct wl1271 *wl, bool plt)
return ret; return ret;
} }
static int wl1271_fetch_nvs(struct wl1271 *wl) static void wl1271_fetch_nvs(struct wl1271 *wl)
{ {
const struct firmware *fw; const struct firmware *fw;
int ret; int ret;
@ -723,16 +723,15 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
ret = request_firmware(&fw, WL12XX_NVS_NAME, wl->dev); ret = request_firmware(&fw, WL12XX_NVS_NAME, wl->dev);
if (ret < 0) { if (ret < 0) {
wl1271_error("could not get nvs file %s: %d", WL12XX_NVS_NAME, wl1271_debug(DEBUG_BOOT, "could not get nvs file %s: %d",
ret); WL12XX_NVS_NAME, ret);
return ret; return;
} }
wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL); wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!wl->nvs) { if (!wl->nvs) {
wl1271_error("could not allocate memory for the nvs file"); wl1271_error("could not allocate memory for the nvs file");
ret = -ENOMEM;
goto out; goto out;
} }
@ -740,8 +739,6 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
out: out:
release_firmware(fw); release_firmware(fw);
return ret;
} }
void wl12xx_queue_recovery_work(struct wl1271 *wl) 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) if (ret < 0)
goto out; 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: out:
return ret; return ret;
} }
@ -4937,8 +4927,8 @@ static int wl1271_register_hw(struct wl1271 *wl)
if (wl->mac80211_registered) if (wl->mac80211_registered)
return 0; return 0;
ret = wl1271_fetch_nvs(wl); wl1271_fetch_nvs(wl);
if (ret == 0) { if (wl->nvs != NULL) {
/* NOTE: The wl->nvs->nvs element must be first, in /* NOTE: The wl->nvs->nvs element must be first, in
* order to simplify the casting, we assume it is at * order to simplify the casting, we assume it is at
* the beginning of the wl->nvs structure. * the beginning of the wl->nvs structure.