Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342089
b: refs/heads/master
c: 576d28a
h: refs/heads/master
i:
  342087: dc7e70b
v: v3
  • Loading branch information
Larry Finger authored and John W. Linville committed Dec 10, 2012
1 parent fa1d003 commit b5f44c7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f80f01483d122174d9aa7864a8ac4050ba6daaa
refs/heads/master: 576d28a7c73013717311cfcb514dbcae27c82eeb
5 changes: 5 additions & 0 deletions trunk/drivers/net/wireless/b43legacy/b43legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_driver_chipcommon.h>
#include <linux/completion.h>

#include <net/mac80211.h>

Expand Down Expand Up @@ -733,6 +734,10 @@ struct b43legacy_wldev {

/* Firmware data */
struct b43legacy_firmware fw;
const struct firmware *fwp; /* needed to pass fw pointer */

/* completion struct for firmware loading */
struct completion fw_load_complete;

/* Devicelist in struct b43legacy_wl (all 802.11 cores) */
struct list_head list;
Expand Down
37 changes: 31 additions & 6 deletions trunk/drivers/net/wireless/b43legacy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,9 +1513,17 @@ static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
"and download the correct firmware (version 3).\n");
}

static void b43legacy_fw_cb(const struct firmware *firmware, void *context)
{
struct b43legacy_wldev *dev = context;

dev->fwp = firmware;
complete(&dev->fw_load_complete);
}

static int do_request_fw(struct b43legacy_wldev *dev,
const char *name,
const struct firmware **fw)
const struct firmware **fw, bool async)
{
char path[sizeof(modparam_fwpostfix) + 32];
struct b43legacy_fw_header *hdr;
Expand All @@ -1528,7 +1536,24 @@ static int do_request_fw(struct b43legacy_wldev *dev,
snprintf(path, ARRAY_SIZE(path),
"b43legacy%s/%s.fw",
modparam_fwpostfix, name);
err = request_firmware(fw, path, dev->dev->dev);
b43legacyinfo(dev->wl, "Loading firmware %s\n", path);
if (async) {
init_completion(&dev->fw_load_complete);
err = request_firmware_nowait(THIS_MODULE, 1, path,
dev->dev->dev, GFP_KERNEL,
dev, b43legacy_fw_cb);
if (err) {
b43legacyerr(dev->wl, "Unable to load firmware\n");
return err;
}
/* stall here until fw ready */
wait_for_completion(&dev->fw_load_complete);
if (!dev->fwp)
err = -EINVAL;
*fw = dev->fwp;
} else {
err = request_firmware(fw, path, dev->dev->dev);
}
if (err) {
b43legacyerr(dev->wl, "Firmware file \"%s\" not found "
"or load failed.\n", path);
Expand Down Expand Up @@ -1580,7 +1605,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
filename = "ucode4";
else
filename = "ucode5";
err = do_request_fw(dev, filename, &fw->ucode);
err = do_request_fw(dev, filename, &fw->ucode, true);
if (err)
goto err_load;
}
Expand All @@ -1589,7 +1614,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
filename = "pcm4";
else
filename = "pcm5";
err = do_request_fw(dev, filename, &fw->pcm);
err = do_request_fw(dev, filename, &fw->pcm, false);
if (err)
goto err_load;
}
Expand All @@ -1607,7 +1632,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
default:
goto err_no_initvals;
}
err = do_request_fw(dev, filename, &fw->initvals);
err = do_request_fw(dev, filename, &fw->initvals, false);
if (err)
goto err_load;
}
Expand All @@ -1627,7 +1652,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
default:
goto err_no_initvals;
}
err = do_request_fw(dev, filename, &fw->initvals_band);
err = do_request_fw(dev, filename, &fw->initvals_band, false);
if (err)
goto err_load;
}
Expand Down

0 comments on commit b5f44c7

Please sign in to comment.