Received: by 10.213.65.68 with SMTP id h4csp851329imn; Wed, 14 Mar 2018 01:51:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELuXrnBwaJhBI+ytbBprObPzby0bBZg53Yotj7Bqrpkl1LIo2YRx6URxlqre84D7TBdQ1v2x X-Received: by 10.101.68.141 with SMTP id l13mr3106451pgq.216.1521017506257; Wed, 14 Mar 2018 01:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521017506; cv=none; d=google.com; s=arc-20160816; b=aLscRNtdQaprWa4UM9rUUqwcKB/bylJYsaLQaHrcL6K7we2TnBNY5iFc+Rg8Xykln0 Bx0G7tpbXFTN9EjD+loNTsGAujU502j0zZUaJBCN4hbXKPwWPmiQ5mY9Q62pJYlNLEJI ciwxP5CuRVd/S1j3g9DwyXw2cYWo4KBXEgjZv60GRjmYQeg04nuIVkjqoudQHE5jYXuZ h5hlYW09ZMYb9mGCrTCvJXq7V5RD7nAKZxJ5edZj2seVp0Md2esAL5G2Xtfr8CIDs32b 4EPmx2ehydLwymx5u9kyOz2hdPVU1CCVizMBxDV+ICStor/mxThmzU8YYZH+nyXoTB+o p0JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=qecmmof22t4YrS6vrWcdiFg4T9ctEFvWE925ODv0wm8=; b=WJaFocHUFyTo5zeyyHJSbQz/tq9z58poDmWvdECE1DMVRy41/Wwei0j2PSNa1mENTP NhoA5ILN7SjzviC4sC+RGVfCyDYms1ZdJe85FX+7URRX4xK3z+orraXfFpycJeunEUPY UMrYvVNa5LNrHGLPujYaSkQXr0J8r/aO0oQRCwvWursCL0Jp33l2JDeLW+JbTCKzI5h2 UFLbUujuJ6fAf8hrfhPm6J6Lsf4KQUQPSKWb19FPd+9+2uP5rBdhjzWE6rzElYQNBh9x 5ddHgo09fhCtDy9+GbdJ20gkLHg0yD7REAGm5ndGHvyG8C+n8M377VfRs1vnlDziOoJL P3vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ooNvhnEQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=ooNvhnEQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f33-v6si1623038plb.482.2018.03.14.01.51.32; Wed, 14 Mar 2018 01:51:46 -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=@codeaurora.org header.s=default header.b=ooNvhnEQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=ooNvhnEQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753424AbeCNIsy (ORCPT + 99 others); Wed, 14 Mar 2018 04:48:54 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58542 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbeCNIsw (ORCPT ); Wed, 14 Mar 2018 04:48:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8B64460849; Wed, 14 Mar 2018 08:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521017331; bh=MCUBh1hwe/HUmcl+W6qXCQvWB//H6IoMpHLTDc0cb3k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ooNvhnEQjdrxdsqDZsWGYeuKG1l0TOcCjTk8PpGABGJGo8XvWQWOPJ1NiPq3tdGDh BX2uqQmipyaBjROQ1SU+G71FznsAQ3tI1U8OhFu/gZ1bveR5wu5E+CumYLXj7yKtct 3XYLGof6IEeTld6Eu5Er751KAt+KVLv8Y4JF1/EE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from x230.qca.qualcomm.com (88-114-240-52.elisa-laajakaista.fi [88.114.240.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 609B06081A; Wed, 14 Mar 2018 08:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521017331; bh=MCUBh1hwe/HUmcl+W6qXCQvWB//H6IoMpHLTDc0cb3k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ooNvhnEQjdrxdsqDZsWGYeuKG1l0TOcCjTk8PpGABGJGo8XvWQWOPJ1NiPq3tdGDh BX2uqQmipyaBjROQ1SU+G71FznsAQ3tI1U8OhFu/gZ1bveR5wu5E+CumYLXj7yKtct 3XYLGof6IEeTld6Eu5Er751KAt+KVLv8Y4JF1/EE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 609B06081A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Arend van Spriel Cc: "Luis R. Rodriguez" , Andres Rodriguez , "linux-kernel\@vger.kernel.org" , Greg Kroah-Hartman , linux-wireless Subject: Re: [PATCH] firmware: add a function to load optional firmware v2 References: <20180309221243.15489-2-andresx7@gmail.com> <20180309230925.3573-1-andresx7@gmail.com> <87a7vcazf1.fsf@kamboji.qca.qualcomm.com> <20180313164026.GG4449@wotan.suse.de> <87fu53apod.fsf@kamboji.qca.qualcomm.com> <5AA8DC29.2000806@broadcom.com> Date: Wed, 14 Mar 2018 10:48:46 +0200 In-Reply-To: <5AA8DC29.2000806@broadcom.com> (Arend van Spriel's message of "Wed, 14 Mar 2018 09:24:09 +0100") Message-ID: <87vadz6o0h.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arend van Spriel writes: > On 3/13/2018 5:46 PM, Kalle Valo wrote: >> "Luis R. Rodriguez" writes: >> >>> On Tue, Mar 13, 2018 at 03:16:34PM +0200, Kalle Valo wrote: >>>> "Luis R. Rodriguez" writes: >>>> >>>>>> +/** >>>>>> + * request_firmware_optional: - request for an optional fw module >>>>>> + * @firmware_p: pointer to firmware image >>>>>> + * @name: name of firmware file >>>>>> + * @device: device for which firmware is being loaded >>>>>> + * >>>>>> + * This function is similar in behaviour to request_firmware(), except >>>>>> + * it doesn't produce warning messages when the file is not found. >>>>>> + **/ >>>>>> +int >>>>>> +request_firmware_optional(const struct firmware **firmware_p, const char *name, >>>>>> + struct device *device) >>>>>> +{ >>>>>> + int ret; >>>>>> + >>>>>> + /* Need to pin this module until return */ >>>>>> + __module_get(THIS_MODULE); >>>>>> + ret = _request_firmware(firmware_p, name, device, NULL, 0, >>>>>> + FW_OPT_UEVENT | FW_OPT_NO_WARN ); >>>>>> + module_put(THIS_MODULE); >>>>>> + return ret; >>>>>> +} >>>>>> +EXPORT_SYMBOL(request_firmware_optional); >>>>> >>>>> New exported symbols for the firmware API should be EXPORT_SYMBOL_GPL(). >>>> >>>> To me the word optional feels weird to me. For example, in ath10k I >>>> suspect we would be only calling request_firmware_optional() with all >>>> firmware and not request_firmware() at all. >>>> >>>> How about request_firmware_nowarn()? That would even match the >>>> documentation above. >>> >>> _nowarn() works with me. Do you at least want the return value to give >>> an error value if no file was found? This way the driver can decide >>> when to issue an error if it wants to. >> >> Yes, it would be very good to return the error value to ath10k. That way >> we can give a proper error message to the user if we can't find a >> suitable firmware image. > > I fully agree with the _nowarn() and returning an error. However, the > firmware_p parameter (btw. do we really want the _p postfix?) Oh yeah, that _p is ugly. Please get rid of it, hungarian notation is awful. > is an output parameter which will be null in case of an error so do > you really need a specific error code for the proper error message. Sometimes the error code helps with debugging. But let's ask it this way: why would we NOT return an error code? What would we gain from that? I don't see any advantage from dropping the error code, on the contrary better to be consistent with request_firmware() to avoid any confusion. -- Kalle Valo