mac80211: update brcmfmac including missing boardrev workaround
[openwrt.git] / package / kernel / mac80211 / patches / 345-brcmfmac-Remove-waitqueue_active-check.patch
1 From: Hui Wang <hui.wang@canonical.com>
2 Date: Wed, 9 Mar 2016 15:25:26 +0800
3 Subject: [PATCH] brcmfmac: Remove waitqueue_active check
4
5 We met a problem of pm_suspend  when repeated closing/opening the lid
6 on a Lenovo laptop (1/20 reproduce rate), below is the log:
7
8 [ 199.735876] PM: Entering mem sleep
9 [ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
10 [ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
11 [ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
12 [ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
13 [ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
14 [ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5
15
16 Through debugging, we found when problem happens, it is not the device
17 fails to enter D3, but the signal D3_ACK comes too early to pass the
18 waitqueue_active() check.
19
20 Just like this:
21 brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
22 // signal is triggered here
23 wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
24                    BRCMF_PCIE_MBDATA_TIMEOUT);
25
26 So far I think it is safe to remove waitqueue_active check since there
27 is only one place to trigger this signal (sending
28 BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
29 event earlier than calling wait_event.
30
31 Cc: Brett Rudley <brudley@broadcom.com>
32 Cc: Hante Meuleman <meuleman@broadcom.com>
33 Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
34 Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
35 Cc: Arend van Spriel <arend@broadcom.com>
36 Signed-off-by: Hui Wang <hui.wang@canonical.com>
37 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
38 ---
39
40 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
41 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
42 @@ -677,10 +677,8 @@ static void brcmf_pcie_handle_mb_data(st
43                 brcmf_dbg(PCIE, "D2H_MB_DATA: DEEP SLEEP EXIT\n");
44         if (dtoh_mb_data & BRCMF_D2H_DEV_D3_ACK) {
45                 brcmf_dbg(PCIE, "D2H_MB_DATA: D3 ACK\n");
46 -               if (waitqueue_active(&devinfo->mbdata_resp_wait)) {
47 -                       devinfo->mbdata_completed = true;
48 -                       wake_up(&devinfo->mbdata_resp_wait);
49 -               }
50 +               devinfo->mbdata_completed = true;
51 +               wake_up(&devinfo->mbdata_resp_wait);
52         }
53  }
54