source: branches/chaos_calmer/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch @ 49406

Last change on this file since 49406 was 49406, checked in by rmilecki, 12 months ago

mac80211: brcmfmac: backport patches that were skipped previously #2

Signed-off-by: Rafał Miłecki <rafal@…>

File size: 2.9 KB
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

    From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
    Date: Mon, 8 Jun 2015 16:11:40 +0200
    Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    This is needed by OpenWrt which expects all PHYs to be created after
    module loads successfully.
    
    Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
    ---
    
    a b int __init brcmf_core_init(void) 
    12131213{ 
    12141214        if (!schedule_work(&brcmf_driver_work)) 
    12151215                return -EBUSY; 
     1216        flush_work(&brcmf_driver_work); 
    12161217 
    12171218        return 0; 
    12181219} 
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c

    a b struct brcmf_fw { 
    444444        u16 bus_nr; 
    445445        void (*done)(struct device *dev, const struct firmware *fw, 
    446446                     void *nvram_image, u32 nvram_len); 
     447        struct completion *completion; 
    447448}; 
    448449 
    449450static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) 
    static void brcmf_fw_request_nvram_done( 
    478479                goto fail; 
    479480 
    480481        fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length); 
     482        if (fwctx->completion) 
     483                complete(fwctx->completion); 
    481484        kfree(fwctx); 
    482485        return; 
    483486 
    fail: 
    485488        brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); 
    486489        release_firmware(fwctx->code); 
    487490        device_release_driver(fwctx->dev); 
     491        if (fwctx->completion) 
     492                complete(fwctx->completion); 
    488493        kfree(fwctx); 
    489494} 
    490495 
    static void brcmf_fw_request_code_done(c 
    500505        /* only requested code so done here */ 
    501506        if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) { 
    502507                fwctx->done(fwctx->dev, fw, NULL, 0); 
     508                if (fwctx->completion) 
     509                        complete(fwctx->completion); 
    503510                kfree(fwctx); 
    504511                return; 
    505512        } 
    static void brcmf_fw_request_code_done(c 
    517524fail: 
    518525        brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); 
    519526        device_release_driver(fwctx->dev); 
     527        if (fwctx->completion) 
     528                complete(fwctx->completion); 
    520529        kfree(fwctx); 
    521530} 
    522531 
    int brcmf_fw_get_firmwares_pcie(struct d 
    528537                                u16 domain_nr, u16 bus_nr) 
    529538{ 
    530539        struct brcmf_fw *fwctx; 
     540        struct completion completion; 
     541        int err; 
    531542 
    532543        brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); 
    533544        if (!fw_cb || !code) 
    int brcmf_fw_get_firmwares_pcie(struct d 
    548559        fwctx->domain_nr = domain_nr; 
    549560        fwctx->bus_nr = bus_nr; 
    550561 
    551         return request_firmware_nowait(THIS_MODULE, true, code, dev, 
     562        init_completion(&completion); 
     563        fwctx->completion = &completion; 
     564 
     565        err = request_firmware_nowait(THIS_MODULE, true, code, dev, 
    552566                                       GFP_KERNEL, fwctx, 
    553567                                       brcmf_fw_request_code_done); 
     568        if (!err) 
     569                wait_for_completion_timeout(fwctx->completion, 
     570                                            msecs_to_jiffies(5000)); 
     571        fwctx->completion = NULL; 
     572        return err; 
    554573} 
    555574 
    556575int brcmf_fw_get_firmwares(struct device *dev, u16 flags, 
Note: See TracBrowser for help on using the repository browser.