Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932723AbdIRPOx (ORCPT ); Mon, 18 Sep 2017 11:14:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49398 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753310AbdIRPOu (ORCPT ); Mon, 18 Sep 2017 11:14:50 -0400 Date: Mon, 18 Sep 2017 17:15:01 +0200 From: Greg KH To: "Luis R. Rodriguez" Cc: wagi@monom.org, yi1.li@linux.intel.com, takahiro.akashi@linaro.org, bjorn.andersson@linaro.org, luto@kernel.org, ebiederm@xmission.com, dmitry.torokhov@gmail.com, arend.vanspriel@broadcom.com, dwmw2@infradead.org, rjw@rjwysocki.net, atull@kernel.org, moritz.fischer@ettus.com, pmladek@suse.com, johannes.berg@intel.com, emmanuel.grumbach@intel.com, luciano.coelho@intel.com, kvalo@codeaurora.org, torvalds@linux-foundation.org, keescook@chromium.org, dhowells@redhat.com, pjones@redhat.com, hdegoede@redhat.com, alan@linux.intel.com, tytso@mit.edu, dave@stgolabs.net, mawilcox@microsoft.com, tglx@linutronix.de, peterz@infradead.org, mfuzzey@parkeon.com, jakub.kicinski@netronome.com, nbroeking@me.com, jewalt@lgsinnovations.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] firmware: cleanup - group and document up private firmware parameters Message-ID: <20170918151501.GA18534@kroah.com> References: <20170914225422.31034-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170914225422.31034-1-mcgrof@kernel.org> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1925 Lines: 60 On Thu, Sep 14, 2017 at 03:54:22PM -0700, Luis R. Rodriguez wrote: > +enum fw_priv_reqs { > + FW_PRIV_REQ_FALLBACK = 1 << 0, > + FW_PRIV_REQ_FALLBACK_UEVENT = 1 << 1, > + FW_PRIV_REQ_NO_CACHE = 1 << 2, > + FW_PRIV_REQ_OPTIONAL = 1 << 3, > +}; checkpatch.pl didn't complain about a lack of using BIT()? > + > +/** > + * struct fw_priv_params - private firmware parameters > + * @mode: mode of operation > + * @priv_reqs: private set of &enum fw_priv_reqs, private requirements for > + * the firmware request > + * @alloc_buf: buffer area allocated by the caller so we can place the > + * respective firmware > + * @alloc_buf_size: size of the @alloc_buf > + */ > +struct fw_priv_params { > + enum fw_api_mode mode; > + u64 priv_reqs; Agreed that this should not be "priv_reqs" but some other better name. > + void *alloc_buf; > + size_t alloc_buf_size; > +}; > + > +#define fw_req_param_sync(priv_params) \ > + (priv_params->mode == FW_API_SYNC) > +#define fw_req_param_async(priv_params) \ > + (priv_params->mode == FW_API_ASYNC) > + > +#define fw_param_use_fallback(params) \ > + (!!((params)->priv_reqs & FW_PRIV_REQ_FALLBACK)) > +#define fw_param_uevent(params) \ > + (!!((params)->priv_reqs & FW_PRIV_REQ_FALLBACK_UEVENT)) > +#define fw_param_nocache(params) \ > + (!!((params)->priv_reqs & FW_PRIV_REQ_NO_CACHE)) > +#define fw_param_optional(params) \ > + (!!((params)->priv_reqs & FW_PRIV_REQ_OPTIONAL)) static inline functions to get proper typechecking? > static bool fw_get_builtin_firmware(struct firmware *fw, const char *name, > - void *buf, size_t size) > + struct fw_priv_params *fw_priv_params) Shouldn't the priv pointer hang off of 'struct firmware' in an opaque type that can not be seen/accessed outside of this file? That way you don't have to change the functions by adding new parameters, what you did seems a lot more complex. thanks, greg k-h