From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: mazziesaccount@gmail.com,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andy@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions
Date: Wed, 11 Dec 2019 16:54:50 +0200 [thread overview]
Message-ID: <20191211145450.GV32742@smile.fi.intel.com> (raw)
In-Reply-To: <b14ba01f6fcbaffbbfbfe1f257fd25691671c652.1576073444.git.matti.vaittinen@fi.rohmeurope.com>
On Wed, Dec 11, 2019 at 04:32:24PM +0200, Matti Vaittinen wrote:
> Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when
> returning GPIO direction to GPIO framework.
Thanks for the patch!
My comment below.
> - return !!(padcfg0 & PADCFG0_GPIOTXDIS);
> + return padcfg0 & PADCFG0_GPIOTXDIS ? GPIO_LINE_DIRECTION_IN :
> + GPIO_LINE_DIRECTION_OUT;
Despite I have told about ternary operator before, the most important here is
readability as well. With these definitions applied to the initial code the
readability has been slightly decreased.
Two variants to fix, though I prefer second one due to less stack use.
1/
u32 tmp;
...
tmp = padcfg0 & PADCFG0_GPIOTXDIS;
return tmp ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
2/
if (padcfg0 & PADCFG0_GPIOTXDIS)
return GPIO_LINE_DIRECTION_IN;
return GPIO_LINE_DIRECTION_OUT;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-12-11 14:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 14:31 [PATCH 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
2019-12-11 14:32 ` [PATCH 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Matti Vaittinen
2019-12-11 14:54 ` Andy Shevchenko [this message]
2019-12-11 14:32 ` [PATCH 2/3] pinctrl: pinctrl-cherryview: " Matti Vaittinen
2019-12-11 14:55 ` Andy Shevchenko
2019-12-11 14:33 ` [PATCH 3/3] pinctrl: pinctrl-baytrail: " Matti Vaittinen
2019-12-11 14:55 ` 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=20191211145450.GV32742@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=mika.westerberg@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
all inboxes | Powered by JetHome®