Received: by 10.192.165.148 with SMTP id m20csp1107246imm; Sat, 21 Apr 2018 01:08:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/esehSHWkjAIz9JaG7vBRA56FHK0RC3VlLxfAl4iL8eORRZArGcD8jHrVeC3dIeXORbVB3 X-Received: by 10.101.69.1 with SMTP id n1mr10524834pgq.175.1524298111013; Sat, 21 Apr 2018 01:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524298110; cv=none; d=google.com; s=arc-20160816; b=T1SwqXNCo2tuYzk5f2ArY2SYQZAThKUDNrJxSUnL+Ul/A8nMN7SfqJDP9ENKohEgmt rW+DoDoFAYJd6E+et/Aqsdapn0EkDzgLxHPmExzBaiLUgOX18A/8hBPBqC+Qgo6d100Y VM6MSr7vKS3uYkP8zsOqXvnUfF+XasUfHKGmM/8Cq+rJ9gKurPRwPr5oZoDuiOPqMeCS 9pWiahxWycEDQoxQPwMSUhXNBk7g3rppBZV+KF++pGLUkmA57sconHDVpjFfUle+cjms gcdw5/jekIvcCegsIDsVbpfgQgQJZ6FkFVYa9hA6t+4tp96euT2GYOQcjDO4VJxtNPKf wHsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=GOBIa1ZjC0A/HuIRJLE98quRQqZiJVWyqxoolQMu0Bs=; b=rkR5DlirBxm9OLGqqZRn5SGEmdwPdW2yoERnnpXh3uZl4Cp9zvFdyxjmgyooC8o2p3 /L/ENmSsN4FyLZBpMn5zZj84rgYNToMnvX8AXOHzJq+S2VjTsC3ROSOINojcS++66L8N jynozsBtKxmRomIm341yEcJFkIJSh0/R8/0Xq08mDiPq2v1Glcd5vGqeJqhjlezu66Eu QH4cRG6iOcHE0wTs/3d4xIU485pfTz1pFIVHk6fVVGXdTm8Equ+0yHJSjOBTs8QGY1Ne S1JEj3/U+vEpyQwTJCfkZzNpGVUgAOZcLq2/lkP2o9Oon4eyM8sYpZUgt2lHISFX9Ms4 BOeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=LFY7ce5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10-v6si6259350pln.120.2018.04.21.01.07.51; Sat, 21 Apr 2018 01:08:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=LFY7ce5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbeDUIFG (ORCPT + 99 others); Sat, 21 Apr 2018 04:05:06 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33042 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbeDUIFB (ORCPT ); Sat, 21 Apr 2018 04:05:01 -0400 Received: by mail-wr0-f193.google.com with SMTP id z73-v6so28380752wrb.0 for ; Sat, 21 Apr 2018 01:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=GOBIa1ZjC0A/HuIRJLE98quRQqZiJVWyqxoolQMu0Bs=; b=LFY7ce5RhVkB0YqE8oZFPp14NmAypFr4YXtsD0iSF/dJ7Zda8+d4dnUAB11RuLo/Ph SSBhPER+oalZ3rlAFmz4VqtFuboSZ0jS1prhmSmFZqwB48hoX3HY3dmU8DODnnO6gkOk +0vsRTTw2e34dRhgHwrEnvLAQYbwuExrKUQfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=GOBIa1ZjC0A/HuIRJLE98quRQqZiJVWyqxoolQMu0Bs=; b=BCgfY+Vyv6mHILEArKvLwvbrDVcvyUWy41MgXWMsiJEuj1YdwHJBFV7pc5MpbB3uRG cxR07vXFgitVuZffxdk3FQpgSMfH3TgesFfdb1fKShuodMoUPAYm2syOFUrSvJmAlrp9 1nsvRqjMAaHvVCxK9j9js2C+tQzKwWB1I88ECLkhsaZ+aoPv+z05ThdN+ubTbRgTaVll eBVGZqjWqC1zppCiXVgqh/uLLdisgq8Ub3ljUOlM6T0kgNDMTaBS0S/60m2RI7QXIdMd 3fa4YC+4SSrupVvvrM8h2Yw5IYiAmR32hMY0S5FY+MUWayTJLH+/WtfuU5Gfoc63Le/2 FRkg== X-Gm-Message-State: ALQs6tDQuVbnMb2PmVqXSbymb0+4RAwe6DcGtnYMY2/jwTzzPhlircCU dbOZopEN1gcVJd5/Sv95CZ3lKg== X-Received: by 10.80.173.105 with SMTP id z38mr18144016edc.306.1524297899625; Sat, 21 Apr 2018 01:04:59 -0700 (PDT) Received: from [192.168.178.129] (f140230.upc-f.chello.nl. [80.56.140.230]) by smtp.gmail.com with ESMTPSA id j90sm4369956edb.12.2018.04.21.01.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Apr 2018 01:04:59 -0700 (PDT) Subject: Re: [PATCH 9/9] brcmfmac: use request_firmware_nowait2 to load firmware without warnings To: Kalle Valo , Andres Rodriguez References: <20180417153307.3693-1-andresx7@gmail.com> <20180417153307.3693-10-andresx7@gmail.com> <87h8o6i36l.fsf@kamboji.qca.qualcomm.com> Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, mcgrof@kernel.org, alexdeucher@gmail.com, ckoenig.leichtzumerken@gmail.com, linux-wireless@vger.kernel.org From: Arend van Spriel Message-ID: <5ADAF0A9.2090604@broadcom.com> Date: Sat, 21 Apr 2018 10:04:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <87h8o6i36l.fsf@kamboji.qca.qualcomm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/20/2018 12:26 PM, Kalle Valo wrote: > Andres Rodriguez writes: > >> This reduces the unnecessary spew when trying to load optional firmware: >> "Direct firmware load for ... failed with error -2" So what happened with the request_firmware_nowarn() api (discussed in another thread). Did it get lost with your kidney stones ;-) ? It seems we start having the same discussion about the asynchronous variant as well here which is a bit counter productive. Let's get back to the issue of the message above. So when is the message unnecessary. To me there are actually to cases in which the message can confuse people searching the log for hints on a issue they have with a device. 1) when the driver requests a sequence of files and only needs one, and 2) when the driver request can be handled by fallback. Why not only issue the error message when the device driver uses request_firmware_direct() or when there is no fallback. Also this patch does not seem to be made against latest code as I did a major rework that went in v4.17-rc1. >> Signed-off-by: Andres Rodriguez >> --- >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) > > With wireless patches always CC linux-wireless list, please. Adding it > now. > >> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c >> index 091b52979e03..26db3ebd52dc 100644 >> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c >> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c >> @@ -503,8 +503,9 @@ 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, >> + ret = request_firmware_nowait(THIS_MODULE, true, false, > > A perfect example why enums should be in function calls instead of > booleans, that "true, false" tells nothing to me and it would be time > consuming to check from headers files what it means. If you had proper > enums, for example "FIRMWARE_MODE_FOO, FIRMWARE_STATE_BAR", it would be > immediately obvious for the reader what the parameters are. Of course > the first boolean was already there before, but maybe change the new > boolean to an enum? I can not fully agree here. While being a bit more descriptive even with enums wrong enum values can be used due to copy-paste errors for instance. Also when reviewing code, sometime looking up function prototypes and type definitions are part of the fun. Tools like ctags or elixir website make it pretty easy. Now regarding this part of the patch the driver is requesting nvram file, which is not always optional. For SDIO devices it is required and for PCIe it is optional so firmware.c module is instructed about this with a flag. So here that flag should be used to pass the proper boolean/call the appropriate function. Actually in the latest code the nvram is request synchronously. >> + fwctx->nvram_name, fwctx->dev, >> + GFP_KERNEL, fwctx, >> brcmf_fw_request_nvram_done); >> >> /* pass NULL to nvram callback for bcm47xx fallback */ >> @@ -547,7 +548,7 @@ int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, >> fwctx->domain_nr = domain_nr; >> fwctx->bus_nr = bus_nr; >> >> - return request_firmware_nowait(THIS_MODULE, true, code, dev, >> + return request_firmware_nowait2(THIS_MODULE, true, false, code, dev, >> GFP_KERNEL, fwctx, >> brcmf_fw_request_code_done); >> } > > Also the number two in the function name is not really telling anything. > I think that something like request_firmware_nowait_nowarn() would be > better, even if it's so ugly. This is requesting the actual firmware that is run by the cpu on the chip so it is not optional. Again, the firmware.c module has been reworked quite a bit in v4.17-rc1 so this patch is outdated. Regards, Arend