From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] globalvar: add set_single function
Date: Mon, 14 Sep 2020 11:13:02 +0200 [thread overview]
Message-ID: <20200914091302.GN4498@pengutronix.de> (raw)
In-Reply-To: <20200912071241.29924-1-r.czerwinski@pengutronix.de>
Hi Rouven,
On Sat, Sep 12, 2020 at 09:12:37AM +0200, Rouven Czerwinski wrote:
> Instead of overwriting the whole hierarchy beneath a globalvar, the
> set_single function only sets the specific globalvar.
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> common/globalvar.c | 11 +++++++++++
> include/globalvar.h | 1 +
> 2 files changed, 12 insertions(+)
>
> diff --git a/common/globalvar.c b/common/globalvar.c
> index 98a028a68a..848a7d6832 100644
> --- a/common/globalvar.c
> +++ b/common/globalvar.c
> @@ -399,6 +399,17 @@ void globalvar_set_match(const char *match, const char *val)
> }
> }
>
> +void globalvar_set_single(const char *match, const char *val)
> +{
> + struct param_d *param;
> +
> + list_for_each_entry(param, &global_device.parameters, list) {
> + if (!strncmp(match, param->name, strlen(match))
> + && strlen(match) == strlen(param->name))
What's the difference between this construct and plain strcmp()?
> + dev_set_param(&global_device, param->name, val);
And then, why not call dev_set_param directly with "match" as argument?
I would rename "match" to "name" as it describes a single variable name.
Also "globalvar_set" is IMO enough as a function name.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-09-14 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-12 7:12 Rouven Czerwinski
2020-09-12 7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
2020-09-12 7:15 ` Rouven Czerwinski
2020-09-12 7:12 ` [PATCH 2/4] blspec: only reset variable locations, not paths Rouven Czerwinski
2020-09-12 7:12 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
2020-09-12 7:12 ` [PATCH 4/4] fastboot: only unset image, not loadaddr Rouven Czerwinski
2020-09-14 9:13 ` Sascha Hauer [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=20200914091302.GN4498@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=r.czerwinski@pengutronix.de \
/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