Merge branch 'linaro-android-3.10-lsk' of git://git.linaro.org/people/jstultz/android...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / b43 / main.c
index a95b77ab360eaf7761bbb93e2eb92ad45ad13e14..0b7edd36cfa22a8121d06d3c356d839c0e59f9cb 100644 (file)
@@ -2068,6 +2068,7 @@ void b43_do_release_fw(struct b43_firmware_file *fw)
 
 static void b43_release_firmware(struct b43_wldev *dev)
 {
+       complete(&dev->fw_load_complete);
        b43_do_release_fw(&dev->fw.ucode);
        b43_do_release_fw(&dev->fw.pcm);
        b43_do_release_fw(&dev->fw.initvals);
@@ -2093,7 +2094,7 @@ static void b43_fw_cb(const struct firmware *firmware, void *context)
        struct b43_request_fw_context *ctx = context;
 
        ctx->blob = firmware;
-       complete(&ctx->fw_load_complete);
+       complete(&ctx->dev->fw_load_complete);
 }
 
 int b43_do_request_fw(struct b43_request_fw_context *ctx,
@@ -2140,7 +2141,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
        }
        if (async) {
                /* do this part asynchronously */
-               init_completion(&ctx->fw_load_complete);
+               init_completion(&ctx->dev->fw_load_complete);
                err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname,
                                              ctx->dev->dev->dev, GFP_KERNEL,
                                              ctx, b43_fw_cb);
@@ -2148,12 +2149,11 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
                        pr_err("Unable to load firmware\n");
                        return err;
                }
-               /* stall here until fw ready */
-               wait_for_completion(&ctx->fw_load_complete);
+               wait_for_completion(&ctx->dev->fw_load_complete);
                if (ctx->blob)
                        goto fw_ready;
        /* On some ARM systems, the async request will fail, but the next sync
-        * request works. For this reason, we dall through here
+        * request works. For this reason, we fall through here
         */
        }
        err = request_firmware(&ctx->blob, ctx->fwname,
@@ -2422,6 +2422,7 @@ error:
 
 static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl);
 static void b43_one_core_detach(struct b43_bus_dev *dev);
+static int b43_rng_init(struct b43_wl *wl);
 
 static void b43_request_firmware(struct work_struct *work)
 {
@@ -2473,6 +2474,10 @@ start_ieee80211:
                goto err_one_core_detach;
        wl->hw_registred = true;
        b43_leds_register(wl->current_dev);
+
+       /* Register HW RNG driver */
+       b43_rng_init(wl);
+
        goto out;
 
 err_one_core_detach:
@@ -4634,9 +4639,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
        if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
                return;
 
-       /* Unregister HW RNG driver */
-       b43_rng_exit(dev->wl);
-
        b43_set_status(dev, B43_STAT_UNINIT);
 
        /* Stop the microcode PSM. */
@@ -4779,9 +4781,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
 
        b43_set_status(dev, B43_STAT_INITIALIZED);
 
-       /* Register HW RNG driver */
-       b43_rng_init(dev->wl);
-
 out:
        return err;
 
@@ -5442,6 +5441,9 @@ static void b43_bcma_remove(struct bcma_device *core)
 
        b43_one_core_detach(wldev->dev);
 
+       /* Unregister HW RNG driver */
+       b43_rng_exit(wl);
+
        b43_leds_unregister(wl);
 
        ieee80211_free_hw(wl->hw);
@@ -5519,6 +5521,9 @@ static void b43_ssb_remove(struct ssb_device *sdev)
 
        b43_one_core_detach(dev);
 
+       /* Unregister HW RNG driver */
+       b43_rng_exit(wl);
+
        if (list_empty(&wl->devlist)) {
                b43_leds_unregister(wl);
                /* Last core on the chip unregistered.