From patchwork Mon Jul 31 15:09:45 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: 9872049 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 41C18602F0 for ; Mon, 31 Jul 2017 15:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256DA283BD for ; Mon, 31 Jul 2017 15:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19CBE285A8; Mon, 31 Jul 2017 15:11:46 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 A93CE2858E for ; Mon, 31 Jul 2017 15:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752364AbdGaPL1 (ORCPT ); Mon, 31 Jul 2017 11:11:27 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35137 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbdGaPLY (ORCPT ); Mon, 31 Jul 2017 11:11:24 -0400 Received: by mail-lf0-f67.google.com with SMTP id w199so12507313lff.2; Mon, 31 Jul 2017 08:11:23 -0700 (PDT) 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=/oiMhy12a6CfLHGuaMIQZma1kMtlNPGDv48fb3sWEx4=; b=kxUn0o66JpiH/1PMa4vXIsGniLQhIRTgwf0iDRlMmTjPR1wLfeiOjiohFGtsi14laN z14GBrbFOPF8COw6xz1JMuf+XVDR9mV0DlmMpHOYRR7rSxi0yqNpag69XbiBCKKNLSny 6rCEOPcQqhnx0P6/dnN70QdyQ8Kvn2EJ3JQxq0p9VIJaSbQ2lHZ5VCcoi8CLiDo6mBsa AjAVfeMX9BBbnASKpbmyBpBoTAW8aMVvBMQw/ZPAFvSHltcq2CKTnbQ4Yp+VokKpHbTQ FJVLZApKJZsVS45B8uyFItX43mK9hwQJao1k12HfwAdSpgBkSHXg/TjcSyHwvQew74Wc mj/w== 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=/oiMhy12a6CfLHGuaMIQZma1kMtlNPGDv48fb3sWEx4=; b=cvVQ+rEep287xFtKN9r17nW6HzLTzWhSz8QdYiOe6EonU3r0H6oqWPGrvtBInBSWvD Ego3wfxO85hB6PH7r/fMmiHQUuiGfz5GrE03JUES0CFkegmiZZQg3E4NLRZqG7cq0l9B m5ofwIk2SWyn14s4mrJj3WVLhZS3mnNvTg4s4rIbJqKmwVRe4A7M1AQiQKsUpQSep8Nb BbinTg3nDUssI1Slx79yXIxoTXYEp2x3VbZvAtFObxJftGHSXMY4Cj9Tw0EH9089MKEf trv2Z1A+65iPFGRVtU78Ydfime9+GVZMHnjGGZlOd1Xfx/9TmllL2PVE7n4adpPKHZfO G5NA== X-Gm-Message-State: AIVw110AFSnD16HqsbZipaiea1ITaau2/nHOe+JYAkGUvId5JYq06ImQ AJBmMby2Bmd7xg== X-Received: by 10.46.32.165 with SMTP id g37mr6316131lji.181.1501513882237; Mon, 31 Jul 2017 08:11:22 -0700 (PDT) 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 b126sm5440328lfe.39.2017.07.31.08.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2017 08:11:21 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: "Luis R . Rodriguez" , Greg Kroah-Hartman Cc: Bjorn Andersson , Daniel Wagner , David Woodhouse , Arend van Spriel , "Rafael J . Wysocki" , yi1.li@linux.intel.com, atull@kernel.org, Moritz Fischer , pmladek@suse.com, Johannes Berg , emmanuel.grumbach@intel.com, luciano.coelho@intel.com, Kalle Valo , luto@kernel.org, Linus Torvalds , Kees Cook , AKASHI Takahiro , David Howells , pjones@redhat.com, Hans de Goede , alan@linux.intel.com, tytso@mit.edu, lkml , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V5 2/2] brcmfmac: don't warn user about NVRAM if fallback to the platform one succeeds Date: Mon, 31 Jul 2017 17:09:45 +0200 Message-Id: <20170731150945.8925-2-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170731150945.8925-1-zajec5@gmail.com> References: <20170731150945.8925-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 NVRAM 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 as they are not expected to have NVRAM file. This is a very common case for Broadcom home routers. Instead of printing warning immediately within the firmware subsystem let's try our fallback code first. 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 with the platform NVRAM. Signed-off-by: Rafał Miłecki Reviewed-by: Arend van Spriel --- 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 V5: Rebase, update commit message, resend after drvdata discussion --- .../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 d231042f19d6..524442b3870f 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 = 0; brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); @@ -503,9 +512,8 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) goto done; 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); /* pass NULL to nvram callback for bcm47xx fallback */ if (ret)