From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Olliver Schinagl <oliver+list@schinagl.nl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Grant Likely <grant.likely@linaro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: gpios search behaviour for gpio from _DSD
Date: Thu, 24 Sep 2015 11:43:24 +0300 [thread overview]
Message-ID: <20150924084324.GK1536@lahna.fi.intel.com> (raw)
In-Reply-To: <5603A552.9020005@schinagl.nl>
On Thu, Sep 24, 2015 at 09:25:06AM +0200, Olliver Schinagl wrote:
> Hey list, Mika,
>
> With commit 0d9a693cc86 the following snippet of code was added:
>
> + /* Try first from _DSD */
> + for (i = 0; i < ARRAY_SIZE(suffixes); i++) {
> + if (con_id && strcmp(con_id, "gpios")) {
> + snprintf(propname, sizeof(propname), "%s-%s",
> + con_id, suffixes[i]);
>
> and I was wondering why the gpios suffix is singled out. Are we not allowed
> to check for all the strings in the suffixes array? Is gpios special or is
> gpio simply not allowed. If that strcmp check would be removed, would bad
> things happen?
We default to "gpios". So if you pass "reset" we actually look for
proprerty "reset-gpios". This is the recommend syntax AFAIK.
> Also, just to educate myself, isn't relying on left to right parsing
> complier specifc? E.g. if con_id is null, we end up passing NULL to strcmp
> and atleast for libc can cause segfaults iirc.
'&&' is so called short circuit operator so if we already know that
con_id is NULL we never evaluate the remaining conditions.
next prev parent reply other threads:[~2015-09-24 8:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 7:25 gpios search behaviour for gpio from _DSD Olliver Schinagl
2015-09-24 8:43 ` Mika Westerberg [this message]
2015-09-26 19:30 ` Olliver Schinagl
2015-09-28 7:30 ` Mika Westerberg
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=20150924084324.GK1536@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=gnurou@gmail.com \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver+list@schinagl.nl \
--cc=rafael.j.wysocki@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