From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Stefan Roese <sr@denx.de>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Yegor Yefremov <yegorslists@googlemail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Giulio Benetti <giulio.benetti@micronovasrl.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johan Hovold <johan@kernel.org>
Subject: Re: [PATCH 2/2 v4] tty/serial/8250: use mctrl_gpio helpers
Date: Tue, 4 Jun 2019 19:52:24 +0300 [thread overview]
Message-ID: <20190604165224.GP9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190603083332.12480-2-sr@denx.de>
On Mon, Jun 03, 2019 at 10:33:32AM +0200, Stefan Roese wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> This patch permits the usage for GPIOs to control
> the CTS/RTS/DTR/DSR/DCD/RI signals.
> + if (up->gpios) {
> + mctrl_gpio_set(up->gpios, mctrl_gpio);
> + }
...
> + if (up->gpios) {
> + mctrl_gpio = mctrl_gpio_get_outputs(up->gpios, &mctrl_gpio);
> + }
...
> + gpios = mctrl_gpio_init(&uart->port, 0);
> + if (IS_ERR(gpios)) {
> + if (PTR_ERR(gpios) != -ENOSYS)
> + return PTR_ERR(gpios);
> + }
...
> + if (IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(up->gpios,
> + UART_GPIO_RTS))) {
> + }
...
> - if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW) {
> + if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW
> + && IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(up->gpios,
> + UART_GPIO_RTS))) {
> }
...
> + if (up->gpios)
> + mctrl_gpio_disable_ms(up->gpios);
...
> + if (up->gpios)
> + mctrl_gpio_enable_ms(up->gpios);
...
> + if (up->gpios)
> + return mctrl_gpio_get(up->gpios, &ret);
Can we rather make this mimic the gpiod_get_optional() API?
So, if we get an error, it's an error, otherwise with NULL pointer the
operations goes to be no-op.
[IS_ERR_OR_NULL() -> IS_ERR(), if (up->gpios) -> /dev/null, etc]
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-06-04 16:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-03 8:33 [PATCH 1/2 v4] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Stefan Roese
2019-06-03 8:33 ` [PATCH 2/2 v4] tty/serial/8250: use mctrl_gpio helpers Stefan Roese
2019-06-04 16:52 ` Andy Shevchenko [this message]
2019-06-05 9:35 ` Stefan Roese
2019-06-04 16:45 ` [PATCH 1/2 v4] serial: mctrl_gpio: Check if GPIO property exisits before requesting it 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=20190604165224.GP9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=giulio.benetti@micronovasrl.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=sr@denx.de \
--cc=yegorslists@googlemail.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;
as well as URLs for NNTP newsgroup(s).