uclient: update to Git HEAD (2024-04-19)
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / brcm / 860-brcmfmac-register-wiphy-s-during-module_init.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Mon, 8 Jun 2015 16:11:40 +0200
3 Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 This is needed by OpenWrt which expects all PHYs to be created after
9 module loads successfully.
10
11 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
12 ---
13
14 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
15 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
16 @@ -429,6 +429,7 @@ struct brcmf_fw {
17 struct brcmf_fw_request *req;
18 u32 curpos;
19 void (*done)(struct device *dev, int err, struct brcmf_fw_request *req);
20 + struct completion *completion;
21 };
22
23 #ifdef CONFIG_EFI
24 @@ -653,6 +654,8 @@ static void brcmf_fw_request_done(const
25 fwctx->req = NULL;
26 }
27 fwctx->done(fwctx->dev, ret, fwctx->req);
28 + if (fwctx->completion)
29 + complete(fwctx->completion);
30 kfree(fwctx);
31 }
32
33 @@ -693,6 +696,8 @@ int brcmf_fw_get_firmwares(struct device
34 {
35 struct brcmf_fw_item *first = &req->items[0];
36 struct brcmf_fw *fwctx;
37 + struct completion completion;
38 + unsigned long time_left;
39 char *alt_path;
40 int ret;
41
42 @@ -710,6 +715,9 @@ int brcmf_fw_get_firmwares(struct device
43 fwctx->dev = dev;
44 fwctx->req = req;
45 fwctx->done = fw_cb;
46 +
47 + init_completion(&completion);
48 + fwctx->completion = &completion;
49
50 /* First try alternative board-specific path if any */
51 alt_path = brcm_alt_fw_path(first->path, fwctx->req->board_type);
52 @@ -726,6 +734,12 @@ int brcmf_fw_get_firmwares(struct device
53 if (ret < 0)
54 brcmf_fw_request_done(NULL, fwctx);
55
56 +
57 + time_left = wait_for_completion_timeout(&completion,
58 + msecs_to_jiffies(5000));
59 + if (!time_left && fwctx)
60 + fwctx->completion = NULL;
61 +
62 return 0;
63 }
64