From: Martin Fuzzey <mfuzzey@parkeon.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>, gregkh@linuxfoundation.org
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,
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
Date: Fri, 15 Sep 2017 10:30:46 +0200 [thread overview]
Message-ID: <59BB8FB6.2040502@parkeon.com> (raw)
In-Reply-To: <20170914225422.31034-1-mcgrof@kernel.org>
Hi Luis,
On 15/09/17 00:54, Luis R. Rodriguez wrote:
> The firmware API has a slew of private options available, which can
> sometimes be hard to understand. When new functionality is introduced
> we also tend to have modify a slew of internal helpers.
>
> Just stuff all common private requirements into its own data structure
> and move features into properly defined flags which can then be carefully
> documented. This:
>
> o reduces the amount of changes we have make as we advance functionality
> o helps remove the #ifdef mess we had created for private features
>
> The above benefits makes the code much easier to understand and maintain.
Yes I agree it is much cleaner that way.
A couple of nitpicks below.
> +/**
> + * enum fw_priv_reqs - private features only used internally
> + *
> + * @FW_PRIV_REQ_FALLBACK: specifies that the firmware request
> + * will use a fallback mechanism if the kernel's direct filesystem
> + * lookup failed to find the requested firmware. If the flag
> + * %FW_PRIV_REQ_FALLBACK is set but the flag
> + * %FW_PRIV_REQ_FALLBACK_UEVENT is not set, it means the caller
> + * is relying on a custom fallback mechanism for firmwarwe lookup as a
> + * fallback mechanism. The custom fallback mechanism is expected to find
> + * any found firmware using the exposed sysfs interface of the
> + * firmware_class. Since the custom fallback mechanism is not compatible
> + * with the internal caching mechanism for firmware lookups at resume,
> + * caching will be disabled when the custom fallback mechanism is used.
> + * @FW_PRIV_REQ_FALLBACK_UEVENT: indicates that the fallback mechanism
> + * this firmware request will rely on will be that of having the kernel
> + * issue a uevent to userspace. Userspace in turn is expected to be
> + * monitoring for uevents for the firmware_class and will use the
> + * exposted sysfs interface to upload the firmware for the caller.
> + * @FW_PRIV_REQ_NO_CACHE: indicates that the firmware request
> + * should not set up and use the internal caching mechanism to assist
> + * drivers from fetching firmware at resume time after suspend.
> + * @FW_PRIV_REQ_OPTIONAL: if set it is not a hard requirement by the
> + * caller that the file requested be present. An error will not be recorded
> + * if the file is not found.
> + */
> +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,
> +};
> +
Why REQ ?
Looks more like a set of flags to me.
Wouldn't FW_PRIV_FLAG_XXX be better?
> +/**
> + * 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;
Not sure the priv_ prefix in the priv_reqs is necessary since the whole
structure is private.
I'd have named it just flags.
Regards,
Martin
next prev parent reply other threads:[~2017-09-15 8:30 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 [this message]
2017-11-11 1:26 ` Luis R. Rodriguez
2017-09-18 15:15 ` Greg KH
2017-11-11 1:32 ` Luis R. Rodriguez
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=59BB8FB6.2040502@parkeon.com \
--to=mfuzzey@parkeon.com \
--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=mcgrof@kernel.org \
--cc=moritz.fischer@ettus.com \
--cc=nbroeking@me.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).