linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>,
	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, "Pali Rohár" <pali.rohar@gmail.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
Date: Sat, 11 Nov 2017 02:32:03 +0100	[thread overview]
Message-ID: <20171111013203.GZ22894@wotan.suse.de> (raw)
In-Reply-To: <20170918151501.GA18534@kroah.com>

On Mon, Sep 18, 2017 at 05:15:01PM +0200, Greg KH wrote:
> 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()?

Fixed.

> > +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.

Went with pri_-flags.

> > +	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?

Sure!

> >  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.

Excellent point!

Note that we already have and use a priv opaque pointer, its however only a buf
pointer really though, I could extend this while looking at doing just that
I noticed that we also already have a "struct firmware_priv" but this is
really only used for the sysfs interface loading functionality. Adding
yet another private pointer is only going to make things more confusing,
so I'll go rename that accordingly and try to consolidate what I can so that
this patch itself is much smaller and easier to read.

Thanks for the feedback!

  Luis

      reply	other threads:[~2017-11-11  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 22:54 [PATCH] firmware: cleanup - group and document up private firmware parameters Luis R. Rodriguez
2017-09-15  8:30 ` Martin Fuzzey
2017-11-11  1:26   ` Luis R. Rodriguez
2017-09-18 15:15 ` Greg KH
2017-11-11  1:32   ` Luis R. Rodriguez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171111013203.GZ22894@wotan.suse.de \
    --to=mcgrof@kernel.org \
    --cc=alan@linux.intel.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=atull@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dave@stgolabs.net \
    --cc=dhowells@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ebiederm@xmission.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jewalt@lgsinnovations.com \
    --cc=johannes.berg@intel.com \
    --cc=keescook@chromium.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=luto@kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=mfuzzey@parkeon.com \
    --cc=moritz.fischer@ettus.com \
    --cc=nbroeking@me.com \
    --cc=pali.rohar@gmail.com \
    --cc=peterz@infradead.org \
    --cc=pjones@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rjw@rjwysocki.net \
    --cc=takahiro.akashi@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=wagi@monom.org \
    --cc=yi1.li@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).