From patchwork Sat Jul 29 09:21:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Joachim X-Patchwork-Id: 9869865 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70E8360353 for ; Sat, 29 Jul 2017 09:22:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66A2928880 for ; Sat, 29 Jul 2017 09:22:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AEC828885; Sat, 29 Jul 2017 09:22:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A27128881 for ; Sat, 29 Jul 2017 09:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753622AbdG2JWA (ORCPT ); Sat, 29 Jul 2017 05:22:00 -0400 Received: from mout.gmx.net ([212.227.15.15]:57298 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753612AbdG2JV5 (ORCPT ); Sat, 29 Jul 2017 05:21:57 -0400 Received: from localhost.localdomain ([91.19.62.57]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M5uLh-1dmiaE3TAH-00xsdL; Sat, 29 Jul 2017 11:21:35 +0200 Received: by localhost.localdomain (Postfix, from userid 1000) id 40C8A80070; Sat, 29 Jul 2017 11:21:31 +0200 (CEST) From: Sven Joachim To: Larry Finger Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Kalle Valo Subject: [PATCH] rtlwifi: Fix fallback firmware loading References: <87k22sq0de.fsf@turtle.gmx.de> Date: Sat, 29 Jul 2017 11:21:31 +0200 In-Reply-To: <87k22sq0de.fsf@turtle.gmx.de> (Sven Joachim's message of "Fri, 28 Jul 2017 13:14:37 +0200") Message-ID: <87a83noaxw.fsf@turtle.gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 X-Provags-ID: V03:K0:LpOx+ENXVLS7bCMvKRLSO++oZ74n1gE4AvCYMkgPaLwNsSsry48 eswQjXiDGAzRjLruCVLyTUZRhaiW9uSbFwTPB/1R7ELNQ8U/dna4z1f25l39Xq/cDzhWTBv 7lfCfLS4cToYIS7NW8KOxOrsZwhg7yNnks3REb+Ety1eV8KBE/M+CLfmXsdIceupERHbpUy LudkzjAcgE0QL/xUElNNw== X-UI-Out-Filterresults: notjunk:1; V01:K0:5vzU2dT6tKw=:HzFLEE0oUAPY7+lNVKnWQi 3JmEMCh4qGE3Mgc9KS1yOxLMWjWiPR3NfiBP9xmyXczCo1vpNB4F7dk3hY4wFNi4sOSzihFbl XRRDTY0rxHN4WE5UyjHkhJ8iua5vrXs5nNka1HQX/089haQdXSo+MewWYHdUD7A4RdOe814Fi 9lyV+2hu6rXCwstqmBOsALEPBd37WnN+i37+R+CdB3srvSUMWHI32qOBhsMNXGPsGZVo2d/kk B063WM6PG961T6QyP0ZEL+tTNAkNvKXz3B6Nnm/KJeBmcRa6YlkpigK9mrhF71PWSQnlklWqK +7iNwtXublbJuAmHPxUYy58WjvAqoy8a/ycHQW0jRQPWUCHAlvojsAaS9pwHmxpUC8vyaZ5rA JGJfBMsaUBB7ZP903kAUVJBG5QaczgGdzKO/KnV6hznW6bf/Ev270Zhr88Q/yoMlaQ8D/AWhS eR8jWIaEo7LnrOpr2wxbiChguz6qLEI8kAkDCPc9yh0YO1/RZk5JhOxsEK3y0lZvStgwThsb1 5pbznirX48z3KZFyk4cPbzebOviUctSQShH2C06F1VywNw3lN8q2Z9sjnv09yfNd5vLJtGp4g zE146y61RdTNKur0IXfMkBjTtbdujlma/Rb/US7ijnMEyZ/CrHnD5nVvqimI4pz/NSszRShdF Wkz1LcUkcOFhlmycRBvnveRVF+W5u47kKvsP3ZHKzXJZBgOhj80ICvwilmLQGn1BTB+xozQkW 2VkWiDxcd9q8jaZrDrabAaVBlxou1tP+boOCSiW4U2mE2b9iBBQVFAmhuo6+nGYeR5fDmwCYq gBSQDYNUG1xIk810z9Quhm7kmcdr6safavDR6rvRpUSSIGXpow= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit f70e4df2 ("rtlwifi: Add code to read new versions of firmware") added code to load an old firmware file if the new one is not available. Unfortunately that code is never reached because request_firmware_nowait() does not wait for the firmware to show up and returns 0 even if the file is not there. Use the existing fallback mechanism introduced by commit 62009b7f ("rtlwifi: rtl8192cu: Add new firmware") instead. Fixes: f70e4df2b384d21e36a7c30a591639592692e0ec Cc: stable@vger.kernel.org Signed-off-by: Sven Joachim --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 13 +++---------- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index f9d10f1e7cf8..1c2d5f6dd3ff 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -187,16 +187,8 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8723befw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request firmware!\n"); - return 1; - } + pr_err("Failed to request firmware!\n"); + return 1; } return 0; } @@ -287,6 +279,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8723be_pci", + .alt_fw_name = "rtlwifi/rtl8723befw.bin", .ops = &rtl8723be_hal_ops, .mod_params = &rtl8723be_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c index d71d2776ca03..0801576bfa89 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c @@ -214,16 +214,8 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8821aefw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request normal firmware!\n"); - return 1; - } + pr_err("Failed to request normal firmware!\n"); + return 1; } /*load wowlan firmware*/ pr_info("Using firmware %s\n", wowlan_fw_name); @@ -325,6 +317,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8821ae_pci", + .alt_fw_name = "rtlwifi/rtl8821aefw.bin", .ops = &rtl8821ae_hal_ops, .mod_params = &rtl8821ae_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,