All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	cantabile.desu@gmail.com, kubakici@wp.pl,
	linux-wireless <linux-wireless@vger.kernel.org>,
	"Kees Cook" <keescook@chromium.org>,
	shuah@kernel.org, "Martin Fuzzey" <mfuzzey@parkeon.com>,
	"Mimi Zohar" <zohar@linux.vnet.ibm.com>,
	"David Howells" <dhowells@redhat.com>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Takashi Iwai" <tiwai@suse.de>,
	"Arend Van Spriel" <arend.vanspriel@broadcom.com>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	"Nicolas Broeking" <nbroeking@me.com>,
	"Vikram Mulukutla" <markivx@codeaurora.org>,
	"Mark Brown" <broonie@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Abhay Salunke" <Abhay_Salunke@dell.com>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	jewalt@lgsinnovations.com, oneukum@suse.com,
	"Alexei Starovoitov" <ast@fb.com>,
	"Andres Rodriguez" <andresx7@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Linux FS Devel" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v3 05/20] firmware: simplify CONFIG_FW_LOADER_USER_HELPER_FALLBACK further
Date: Wed, 14 Mar 2018 15:36:32 -0700	[thread overview]
Message-ID: <CAB=NE6Ur+hHN6HHBzafJXQ_G9AJggHPKd-jvrPmB79k98aTMDw@mail.gmail.com> (raw)
In-Reply-To: <20180314185347.GA15837@kroah.com>

On Wed, Mar 14, 2018 at 11:53 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Sat, Mar 10, 2018 at 06:14:46AM -0800, Luis R. Rodriguez wrote:
>> All CONFIG_FW_LOADER_USER_HELPER_FALLBACK really is, is just a bool,
>> initailized at build time. Define it as such. This simplifies the
>> logic even further, removing now all explicit #ifdefs around the code.
>>
>> Acked-by: Kees Cook <keescook@chromium.org>
>> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
>> ---
>>  drivers/base/firmware_loader.c | 25 ++++++++++++++++++-------
>>  1 file changed, 18 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/base/firmware_loader.c b/drivers/base/firmware_loader.c
>> index 7dd36ace6152..59dba794ce1a 100644
>> --- a/drivers/base/firmware_loader.c
>> +++ b/drivers/base/firmware_loader.c
>> @@ -266,6 +266,22 @@ static inline bool fw_state_is_aborted(struct fw_priv *fw_priv)
>>
>>  #ifdef CONFIG_FW_LOADER_USER_HELPER
>>
>> +/**
>> + * struct firmware_fallback_config - firmware fallback configuratioon settings
>> + *
>> + * Helps describe and fine tune the fallback mechanism.
>> + *
>> + * @force_sysfs_fallback: force the sysfs fallback mechanism to be used
>> + *   as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y.
>> + */
>> +struct firmware_fallback_config {
>> +     bool force_sysfs_fallback;
>> +};
>
> This is C, why are you messing around with a structure and "getters and
> setters" for a set of simple values?
>
>> +static const struct firmware_fallback_config fw_fallback_config = {
>> +     .force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
>> +};
>
> static bool force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK);

For this case yes, but I later expand on this structure for all
fallback configuration items. So we have to start it somewhere.

> Then just read/write the foolish thing, don't make this more complex
> than is needed please.

Please read the final results and let me know what you think.

> There is a "getter and setters are evil" rant somewhere out there
> online, if you really need me to dig up the old tired arguments :)

I don't use them for sport, I use them given the fallback stuff *is*
not something the direct core firmware code should use openly, it will
really depend on if the fallback interface was enabled. As such we
provide wrapper for access into them.

  Luis

  reply	other threads:[~2018-03-14 22:36 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-10 14:14 [PATCH v3 00/20] firmware: development for v4.17 Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 01/20] test_firmware: add simple firmware firmware test library Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 02/20] test_firmware: enable custom fallback testing on limited kernel configs Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 03/20] test_firmware: replace syfs fallback check with kconfig_has helper Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 04/20] firmware: enable to split firmware_class into separate target files Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 05/20] firmware: simplify CONFIG_FW_LOADER_USER_HELPER_FALLBACK further Luis R. Rodriguez
2018-03-14 18:53   ` Greg KH
2018-03-14 22:36     ` Luis R. Rodriguez [this message]
2018-03-10 14:14 ` [PATCH v3 06/20] firmware: use helpers for setting up a temporary cache timeout Luis R. Rodriguez
2018-03-14 18:55   ` Greg KH
2018-03-10 14:14 ` [PATCH v3 07/20] firmware: move loading timeout under struct firmware_fallback_config Luis R. Rodriguez
2018-03-14 18:56   ` Greg KH
2018-03-14 22:33     ` Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 08/20] firmware: split firmware fallback functionality into its own file Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 09/20] firmware: move firmware loader into its own directory Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 10/20] firmware: enable run time change of forcing fallback loader Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 11/20] firmware: enable to force disable the fallback mechanism at run time Luis R. Rodriguez
2018-03-14 19:00   ` Greg KH
2018-03-18 20:20     ` Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 12/20] test_firmware: expand on library with shared helpers Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 13/20] test_firmware: test three firmware kernel configs using a proc knob Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 14/20] rename: _request_firmware_load() fw_load_sysfs_fallback() Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 15/20] firmware: fix checking for return values for fw_add_devm_name() Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 16/20] firmware: add helper to check to see if fw cache is setup Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 17/20] test_firmware: modify custom fallback tests to use unique files Luis R. Rodriguez
2018-03-10 14:14 ` [PATCH v3 18/20] firmware: ensure the firmware cache is not used on incompatible calls Luis R. Rodriguez
2018-03-10 14:15 ` [PATCH v3 19/20] firmware: add request_firmware_cache() to help with cache on reboot Luis R. Rodriguez
2018-03-20  8:30   ` Greg KH
2018-03-20 17:34     ` Luis R. Rodriguez
2018-03-20 17:38       ` Greg KH
2018-03-20 18:24         ` Luis R. Rodriguez
2018-03-20 18:54           ` Konstantin Ryabitsev
2018-03-20 19:51             ` Luis R. Rodriguez
2018-03-21 10:04           ` Greg KH
2018-03-10 14:15 ` [PATCH v3 20/20] mt7601u: use request_firmware_cache() to address " Luis R. Rodriguez
2018-03-13  4:43   ` Jakub Kicinski
2018-03-10 17:16 ` [PATCH v3 00/20] firmware: development for v4.17 Kees Cook
2018-03-14 17:44   ` Luis R. Rodriguez
2018-03-14 17:58     ` Greg KH

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='CAB=NE6Ur+hHN6HHBzafJXQ_G9AJggHPKd-jvrPmB79k98aTMDw@mail.gmail.com' \
    --to=mcgrof@kernel.org \
    --cc=Abhay_Salunke@dell.com \
    --cc=akpm@linux-foundation.org \
    --cc=andresx7@gmail.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=ast@fb.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=cantabile.desu@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jewalt@lgsinnovations.com \
    --cc=keescook@chromium.org \
    --cc=kubakici@wp.pl \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=markivx@codeaurora.org \
    --cc=mfuzzey@parkeon.com \
    --cc=nbroeking@me.com \
    --cc=oneukum@suse.com \
    --cc=pali.rohar@gmail.com \
    --cc=shuah@kernel.org \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=zajec5@gmail.com \
    --cc=zohar@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.