From patchwork Thu Feb 23 18:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9588793 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 D047C60578 for ; Thu, 23 Feb 2017 18:37:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4F661FFB7 for ; Thu, 23 Feb 2017 18:37:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B995E2848E; Thu, 23 Feb 2017 18:37:25 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 3F36C1FFB7 for ; Thu, 23 Feb 2017 18:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751387AbdBWShO (ORCPT ); Thu, 23 Feb 2017 13:37:14 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:32993 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbdBWShN (ORCPT ); Thu, 23 Feb 2017 13:37:13 -0500 Received: by mail-lf0-f67.google.com with SMTP id j2so1724651lfe.0; Thu, 23 Feb 2017 10:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xph4qeejfWFl64vNipc0mSlHbbBPPnDqhnZLXGtrNKY=; b=CIxqFPhEqmp1ifi1TClXJZwnzzbWVfw3Mv3AIdgG2hiotvvCqp5GLxHyG7T8mEB4B9 UxtCLPRbuT2JOl67bPk74J/G3RrK64kBcCZ1ye3ssvICib0g/VHbMx2CURZ6nE5PI3Il jxGzRVsGm5U6TDMiFWsUjNhg7DdVRdCFtXUnow0C0QrIpCJWztNMoazFzgaf5tcOrsk+ aySKnffrWQ/WuRphYj5fhcxUwsEyKkP2KXkpx8uIQUVeIFwfWcYFMcWugmgps4vhzNEh d5UOZat3go2CYblmWiXh8kEnMB3y8uGJUVpdgVgfak8+nhISGjJ1H5FV+PPy+ZqbuymI 2YGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xph4qeejfWFl64vNipc0mSlHbbBPPnDqhnZLXGtrNKY=; b=HBDStkK+rHDpYhKhqHx/yrAkO9UgtaO5sg204kG/y5d2AFX+kC+YhNQXHlOY7JzhP3 3fcVYfXnv61j0MBw/AAMQNX6Rr2J1qIqC0b9jelb46WFOYT+g9oDzMpsKt6vJgEt0ITA RlIjjbbM7qAJaX8z25nDthFABaVlYV5xF9gwnQFCJMjMfJEjbqwBEn09hg9V4m5dvrOG IxSMXbRE3mW0JekmyFW6CwiDj76ayhRjun/BLwo17i1desmoXg9TSeqtOxB233/rjrVD Fn8Z9r0jx94C/MtE4dY5y7VO8NrGDSpM2qjWMZL5iC4OOZDPQvylE97Di2ZricL9jYYR VCgQ== X-Gm-Message-State: AMke39kiasntuWRcNDxpLzwXa8QdR+HoVg18z65tLgfBJ1Z/pUHxUdS6TSNp7wZBXnodHA== X-Received: by 10.46.74.26 with SMTP id x26mr10599638lja.96.1487874629630; Thu, 23 Feb 2017 10:30:29 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id 25sm8110499lju.56.2017.02.23.10.30.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2017 10:30:28 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Ming Lei , "Luis R . Rodriguez" , Greg KH , Linux Kernel Mailing List Cc: Kalle Valo , Arend van Spriel , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V4 2/2] brcmfmac: don't warn user about NVRAM if fallback to platform one succeeds Date: Thu, 23 Feb 2017 19:30:18 +0100 Message-Id: <20170223183018.16704-2-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170223183018.16704-1-zajec5@gmail.com> References: <20170221094754.15406-1-zajec5@gmail.com> <20170223183018.16704-1-zajec5@gmail.com> MIME-Version: 1.0 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 From: Rafał Miłecki Failing to load NVRAM file isn't critical if we manage to get platform one in the fallback path. It means warnings like: [ 10.801506] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2 are unnecessary & disturbing for people with platform NVRAM. This is very common case for Broadcom home routers. So instead of printing warning immediately with the firmware subsystem let's first try our fallback code. If that fails as well, then it's a right moment to print an error. This should reduce amount of false reports from users seeing this warning while having wireless working perfectly fine. Signed-off-by: Rafał Miłecki --- V2: Update commit message as it wasn't clear enough (thanks Andy) & add extra messages to the firmware.c. V3: Set FW_OPT_UEVENT to don't change behavior V4: Switch to the new request_firmware_async syntax --- .../wireless/broadcom/brcm80211/brcmfmac/firmware.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c index c7c1e9906500..da7da1dc059d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c @@ -462,8 +462,14 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) raw_nvram = false; } else { data = bcm47xx_nvram_get_contents(&data_len); - if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) - goto fail; + if (!data) { + brcmf_dbg(TRACE, "Failed to get platform NVRAM\n"); + if (!(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) { + brcmf_err("Loading NVRAM from %s and using platform one both failed\n", + fwctx->nvram_name); + goto fail; + } + } raw_nvram = true; } @@ -491,6 +497,9 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) { struct brcmf_fw *fwctx = ctx; + struct firmware_opts fw_opts = { + .optional = true, + }; int ret; brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); @@ -504,9 +513,8 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) return; } fwctx->code = fw; - ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name, - fwctx->dev, GFP_KERNEL, fwctx, - brcmf_fw_request_nvram_done); + ret = request_firmware_async(fwctx->nvram_name, &fw_opts, fwctx->dev, + fwctx, brcmf_fw_request_nvram_done); if (!ret) return;