From: Sergey Organov <sorganov@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-serial@vger.kernel.org, NXP Linux Team <linux-imx@nxp.com>
Subject: Re: [PATCH v2 7/7] serial: imx: get rid of imx_uart_rts_auto()
Date: Thu, 27 Jun 2019 10:58:13 +0300 [thread overview]
Message-ID: <87v9wrh33e.fsf@osv.gnss.ru> (raw)
In-Reply-To: <20190627060838.ls5ghzngkoiczqex@pengutronix.de> ("Uwe \=\?utf-8\?Q\?Kleine-K\=C3\=B6nig\=22's\?\= message of "Thu, 27 Jun 2019 08:08:38 +0200")
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes:
> On Wed, Jun 26, 2019 at 05:11:33PM +0300, Sergey Organov wrote:
>> Called in only one place, for RS232, it only obscures things, as it
>> doesn't go well with 2 similar named functions,
>> imx_uart_rts_inactive() and imx_uart_rts_active(), that both are
>> RS485-specific.
>>
>> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
>> Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
>> Signed-off-by: Sergey Organov <sorganov@gmail.com>
>> ---
>> drivers/tty/serial/imx.c | 13 ++++---------
>> 1 file changed, 4 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index 171347d..a5e80a0 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -402,13 +402,6 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
>> mctrl_gpio_set(sport->gpios, sport->port.mctrl);
>> }
>>
>> -/* called with port.lock taken and irqs caller dependent */
>> -static void imx_uart_rts_auto(struct imx_port *sport, u32 *ucr2)
>> -{
>> - if (*ucr2 & UCR2_CTS)
>> - *ucr2 |= UCR2_CTSC;
>> -}
>> -
>> /* called with port.lock taken and irqs off */
>> static void imx_uart_start_rx(struct uart_port *port)
>> {
>> @@ -1598,8 +1591,10 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
>> else
>> imx_uart_rts_inactive(sport, &ucr2);
>>
>> - } else if (termios->c_cflag & CRTSCTS)
>> - imx_uart_rts_auto(sport, &ucr2);
>> + } else if (termios->c_cflag & CRTSCTS) {
>> + if (ucr2 & UCR2_CTS)
>> + ucr2 |= UCR2_CTSC;
>> + }
>
> At least before it was (somewhat) clear that this is about RTS and it
> is about something automatic. So I don't like the patch.
Maybe I just need to put a comment here to clarify?
Let me try to convince you removal is a good thing.
Let's try to mentally revert the patch. If we already have
} else if (termios->c_cflag & CRTSCTS) {
if (ucr2 & UCR2_CTS)
ucr2 |= UCR2_CTSC;
}
I see no reason to make 2 lines inside if() a function.
First, it's already obvious it's about something automatic, due to if()
condition itself.
Second, the fact that it's about RTS is as [non-]obvious as in any other
place in the driver, taking into account that iMX calls "RTS" "CTS" and
vice versa.
Finally, should we still argue adding a function would be useful, we'd
need to also add, for consistency,
static void imx_uart_rts_manual(struct imx_port *sport, u32 *ucr2);
(as existing rts_on() and rts_off() do not serve the purpose),
as well as CTS counterparts:
static void imx_uart_cts_auto(struct imx_port *sport, u32 *ucr2);
static void imx_uart_cts_manual(struct imx_port *sport, u32 *ucr2);
and patch the code rather heavily, for no obvious gain.
Overall, I believe adding the function would only obscure things.
OTOH, existence of that function forced me to examine the whole source
just to figure that unlike other 2 similar named, it serves entirely
different logical purpose (i.e., it's _not_ 3-d alternative for those
2), and is not used anywhere else.
Look: when we have rts_auto(), rts_off(), and rts_on(), it's logical to
expect it's one of them that will be called when top-level asks for
automatic RTS/CTS, manual RTS off, and manual RTS on, respectively,
isn't it? But it is not the case at all! Still rts_auto() doesn't fit to
the overall picture.
Thanks!
-- Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-27 7:58 UTC|newest]
Thread overview: 154+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 7:28 [PATCH] serial: imx: fix RTS/CTS setting Sascha Hauer
2019-06-14 7:28 ` Sascha Hauer
2019-06-14 7:48 ` Uwe Kleine-König
2019-06-14 7:48 ` Uwe Kleine-König
2019-06-14 12:11 ` [PATCH RFC 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 1/7] serial: imx: fix locking in set_termios() Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 4/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-20 9:37 ` Sascha Hauer
2019-06-20 9:37 ` Sascha Hauer
2019-06-20 13:24 ` Sergey Organov
2019-06-20 13:24 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 5/7] serial: imx: set_termios(): preserve RTS state Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 13:05 ` Lothar Waßmann
2019-06-14 13:28 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-14 12:11 ` [PATCH RFC 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-06-14 12:11 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 1/7] serial: imx: fix locking in set_termios() Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-20 14:47 ` [PATCH RFC v1 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-06-20 14:47 ` Sergey Organov
2019-06-26 10:00 ` [PATCH RFC v1 0/7] serial: imx: fix RTS and RTS/CTS handling Sascha Hauer
2019-06-26 10:00 ` Sascha Hauer
2019-06-26 11:19 ` Sergey Organov
2019-06-26 11:19 ` Sergey Organov
2019-06-26 14:11 ` [PATCH v2 " Sergey Organov
2019-06-26 14:11 ` [PATCH v2 1/7] serial: imx: fix locking in set_termios() Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 5:05 ` Uwe Kleine-König
2019-06-27 5:05 ` Uwe Kleine-König
2019-06-26 14:11 ` [PATCH v2 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 5:05 ` Uwe Kleine-König
2019-06-27 5:05 ` Uwe Kleine-König
2019-06-26 14:11 ` [PATCH v2 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 5:26 ` Uwe Kleine-König
2019-06-27 5:26 ` Uwe Kleine-König
2019-06-27 5:58 ` Sergey Organov
2019-06-26 14:11 ` [PATCH v2 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 5:40 ` Uwe Kleine-König
2019-06-27 5:40 ` Uwe Kleine-König
2019-06-27 6:15 ` Sergey Organov
2019-06-26 14:11 ` [PATCH v2 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 5:47 ` Uwe Kleine-König
2019-06-27 5:47 ` Uwe Kleine-König
2019-06-27 6:16 ` Sergey Organov
2019-06-26 14:11 ` [PATCH v2 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 6:05 ` Uwe Kleine-König
2019-06-27 6:05 ` Uwe Kleine-König
2019-06-27 7:01 ` Sergey Organov
2019-06-26 14:11 ` [PATCH v2 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-06-26 14:11 ` Sergey Organov
2019-06-27 6:08 ` Uwe Kleine-König
2019-06-27 6:08 ` Uwe Kleine-König
2019-06-27 7:58 ` Sergey Organov [this message]
2019-07-04 13:00 ` [PATCH v3 0/7] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-07-04 13:00 ` [PATCH v3 1/7] serial: imx: fix locking in set_termios() Sergey Organov
2019-07-04 13:00 ` [PATCH v3 2/7] serial: imx: set_termios(): factor-out 'ucr2' initial value Sergey Organov
2019-07-04 13:00 ` [PATCH v3 3/7] serial: imx: set_termios(): clarify RTS/CTS bits calculation Sergey Organov
2019-07-04 13:00 ` Sergey Organov
2019-07-04 13:00 ` [PATCH v3 4/7] serial: imx: set_termios(): preserve RTS state Sergey Organov
2019-07-04 13:00 ` Sergey Organov
2019-07-04 13:00 ` [PATCH v3 5/7] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-07-04 13:00 ` Sergey Organov
2019-07-04 13:00 ` [PATCH v3 6/7] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-07-04 13:00 ` Sergey Organov
2019-07-04 13:00 ` [PATCH v3 7/7] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-07-04 13:00 ` Sergey Organov
2019-07-19 8:47 ` [PATCH v4 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-07-19 8:47 ` [PATCH v4 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-07-19 8:47 ` Sergey Organov
2019-07-19 9:11 ` Uwe Kleine-König
2019-07-19 9:11 ` Uwe Kleine-König
2019-07-19 12:18 ` Sergey Organov
2019-07-19 14:31 ` Uwe Kleine-König
2019-07-19 14:31 ` Uwe Kleine-König
2019-07-19 15:13 ` Sergey Organov
2019-07-19 20:19 ` Uwe Kleine-König
2019-07-19 20:19 ` Uwe Kleine-König
2019-07-22 7:42 ` Sergey Organov
2019-07-22 7:51 ` Uwe Kleine-König
2019-07-22 7:51 ` Uwe Kleine-König
2019-07-22 9:20 ` Sergey Organov
2019-07-22 9:46 ` Uwe Kleine-König
2019-07-22 9:46 ` Uwe Kleine-König
2019-07-22 13:54 ` Sergey Organov
2019-07-22 16:47 ` Uwe Kleine-König
2019-07-22 16:47 ` Uwe Kleine-König
2019-07-22 9:57 ` Russell King - ARM Linux admin
2019-07-22 9:57 ` Russell King - ARM Linux admin
2019-07-22 10:04 ` Uwe Kleine-König
2019-07-22 10:04 ` Uwe Kleine-König
2019-07-22 10:17 ` Russell King - ARM Linux admin
2019-07-22 10:17 ` Russell King - ARM Linux admin
2019-07-19 8:47 ` [PATCH v4 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-07-19 8:47 ` Sergey Organov
2019-07-19 8:47 ` [PATCH v4 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-07-19 8:47 ` Sergey Organov
2019-07-22 9:22 ` [PATCH v5 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-07-22 9:22 ` [PATCH v5 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-07-22 9:54 ` Uwe Kleine-König
2019-07-22 9:54 ` Uwe Kleine-König
2019-07-22 13:57 ` Sergey Organov
2019-07-22 16:20 ` Uwe Kleine-König
2019-07-22 16:20 ` Uwe Kleine-König
2019-07-22 19:09 ` Sergey Organov
2019-07-22 9:22 ` [PATCH v5 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-07-22 9:22 ` [PATCH v5 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-07-22 19:22 ` [PATCH v6 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-07-22 19:22 ` [PATCH v6 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-07-22 19:22 ` [PATCH v6 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-07-22 20:24 ` Uwe Kleine-König
2019-07-22 20:24 ` Uwe Kleine-König
2019-07-23 9:20 ` Sergey Organov
2019-07-23 9:49 ` Uwe Kleine-König
2019-07-23 9:49 ` Uwe Kleine-König
2019-07-23 11:16 ` Sergey Organov
2019-07-23 11:30 ` Sergey Organov
2019-07-22 19:22 ` [PATCH v6 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-07-26 18:52 ` [PATCH v7 0/3] serial: imx: fix RTS and RTS/CTS handling Sergey Organov
2019-07-26 18:52 ` [PATCH v7 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Sergey Organov
2019-07-26 18:52 ` [PATCH v7 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Sergey Organov
2019-07-26 18:52 ` Sergey Organov
2019-07-26 18:52 ` [PATCH v7 3/3] serial: imx: get rid of imx_uart_rts_auto() Sergey Organov
2019-07-26 18:52 ` Sergey Organov
2019-07-26 19:29 ` Uwe Kleine-König
2019-07-26 19:29 ` Uwe Kleine-König
2019-07-29 9:03 ` Sergey Organov
2019-07-29 9:29 ` Uwe Kleine-König
2019-07-29 9:29 ` Uwe Kleine-König
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=87v9wrh33e.fsf@osv.gnss.ru \
--to=sorganov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=u.kleine-koenig@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.