From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Andy Shevchenko
<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"open list:GPIO SUBSYSTEM"
<linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
Sylwester Nawrocki
<sylvester.nawrocki-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Harald Welte <laforge-4Bgg8jF3iZdg9hUCZPvPmw@public.gmane.org>,
Manuel Lauss
<manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>,
Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
Subject: Re: [PATCH 1/3] spi: spi-gpio: Rewrite to use GPIO descriptors
Date: Tue, 13 Feb 2018 16:17:11 +0000 [thread overview]
Message-ID: <20180213161711.GG5988@sirena.org.uk> (raw)
In-Reply-To: <CAHp75VeOf6Zywgn9LWWX1kOwsqw28dhZ5EE+N-0KFX_0m-JxOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]
On Tue, Feb 13, 2018 at 04:17:38PM +0200, Andy Shevchenko wrote:
> On Mon, Feb 12, 2018 at 2:45 PM, Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > + { },
> As commented earlier to the similar change, terminator would terminate
> even at compile time.
> To achieve that just remove comma.
It's fine either way - not having the comma bothers some people just for
the consistency.
> > + /* SPI chip selects are normally active-low */
> > + gpiod_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
> bool invert = !(spi->mode & SPI_CS_HIGH);
> gpiod_set_value_cansleep(cs, !!is_active ^ invert);
Neither of these options is a triumph of legibility but even with my
antipithy for the use of the ternery operator the new suggestion is
still not great - the combination of double negation and exclusive or
is really not super obvious what it's supposed to do.
> But I guess most used pattern is just explicit conditional
> if (spi->mode & SPI_CS_HIGH)
> gpiod_set_value_cansleep(cs, is_active);
> else
> gpiod_set_value_cansleep(cs, !is_active);
Yup, that's very clear.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-02-13 16:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 12:45 [PATCH 0/3] Convert GPIO SPI to use descriptors only Linus Walleij
2018-02-12 12:45 ` [PATCH 1/3] spi: spi-gpio: Rewrite to use GPIO descriptors Linus Walleij
[not found] ` <20180212124532.25776-2-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-13 14:17 ` Andy Shevchenko
[not found] ` <CAHp75VeOf6Zywgn9LWWX1kOwsqw28dhZ5EE+N-0KFX_0m-JxOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-13 16:17 ` Mark Brown [this message]
2018-02-14 16:28 ` Applied "spi: spi-gpio: Rewrite to use GPIO descriptors" to the spi tree Mark Brown
2018-02-12 12:45 ` [PATCH 2/3] spi: spi-gpio: Delete references to non-GENERIC_BITBANG Linus Walleij
[not found] ` <20180212124532.25776-3-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-14 16:01 ` Mark Brown
2018-02-14 18:53 ` Trent Piepho
2018-02-12 12:45 ` [PATCH 3/3] spi: spi-gpio: Augment device tree bindings Linus Walleij
[not found] ` <20180212124532.25776-1-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-13 14:19 ` [PATCH 0/3] Convert GPIO SPI to use descriptors only Andy Shevchenko
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=20180213161711.GG5988@sirena.org.uk \
--to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=agust-ynQEQJNshbs@public.gmane.org \
--cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=laforge-4Bgg8jF3iZdg9hUCZPvPmw@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org \
--cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=sylvester.nawrocki-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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).