From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
linux-arm-kernel@lists.infradead.org,
alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com,
richard.genoud@gmail.com, festevam@gmail.com,
s.hauer@pengutronix.de, linux@armlinux.org.uk,
nicolas.ferre@microchip.com, alexandre.torgue@foss.st.com,
ludovic.desroches@microchip.com, lukas@wunner.de,
linux-imx@nxp.com, kernel@pengutronix.de,
linux-serial@vger.kernel.org, shawnguo@kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] serial: core: move RS485 configuration tasks from drivers into core
Date: Mon, 14 Feb 2022 16:09:53 +0100 [thread overview]
Message-ID: <edbb9e1d-bed4-0850-08f4-029c4fcbfd5c@gmx.de> (raw)
In-Reply-To: <20220214070622.rz5cv6yy3aarvrjv@pengutronix.de>
Hi,
On 14.02.22 at 08:06, Uwe Kleine-König wrote:
> On Sun, Feb 13, 2022 at 11:27:29PM +0100, Lino Sanfilippo wrote:
>> Several drivers that support setting the RS485 configuration via userspace
>> implement on or more of the following tasks:
>
> s/on/one/
Ok
>
>>
>> - in case of an invalid RTS configuration (both RTS after send and RTS on
>> send set or both unset) fall back to enable RTS on send and disable RTS
>> after send
>>
>> - nullify the padding field of the returned serial_rs485 struct
>>
>> - copy the configuration into the uart port struct
>>
>> - limit RTS delays to 100 ms
>>
>> Move these tasks into the serial core to make them generic and to provide
>> a consistent beheviour among all drivers.
>
> s/beheviour/behaviour/
>
Ok
>> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
>> ---
>> drivers/tty/serial/serial_core.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index 846192a7b4bf..3fab4070359c 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -1282,8 +1282,21 @@ static int uart_set_rs485_config(struct uart_port *port,
>> if (copy_from_user(&rs485, rs485_user, sizeof(*rs485_user)))
>> return -EFAULT;
>>
>> + /* pick sane settings if the user hasn't */
>> + if (!(rs485.flags & SER_RS485_RTS_ON_SEND) ==
>> + !(rs485.flags & SER_RS485_RTS_AFTER_SEND)) {
>> + rs485.flags |= SER_RS485_RTS_ON_SEND;
>> + rs485.flags &= ~SER_RS485_RTS_AFTER_SEND;
>> + }
>> + /* clamp the delays to [0, 100ms] */
>> + rs485.delay_rts_before_send = min(rs485.delay_rts_before_send, 100U);
>> + rs485.delay_rts_after_send = min(rs485.delay_rts_after_send, 100U);
>> + memset(rs485.padding, 0, sizeof(rs485.padding));
>> +
>> spin_lock_irqsave(&port->lock, flags);
>> ret = port->rs485_config(port, &rs485);
>> + if (!ret)
>> + port->rs485 = rs485;
>
> I was only Cc:d for the imx patch (patch #7) and tried to verify the
> claim there that "the serial core already assigns the passed
> configuration to the uart port". That failed when I looked at my kernel
> tree.
>
> So it would be great, if you sent dependencies (or at least a cover
> letter) to all recipients of a given patch to ease review. Also I want
> to suggest to mention uart_set_rs485_config() in the commit log of the
> imx patch (and probably the others) to simplify verifying the claim
> there.
>
Thanks for the review, I will correct the typos in the next version.
I will also cc you directly for the next version if you dont mind.
get_maintainers only spit out "Pengutronix Kernel Team" so I used that
address for the whole series (including the cover letter).
Regards,
Lino
next prev parent reply other threads:[~2022-02-14 15:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-13 22:27 Move RS485 implementation from drivers to serial core Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 1/9] serial: core: move RS485 configuration tasks from drivers into core Lino Sanfilippo
2022-02-14 5:41 ` Jiri Slaby
2022-02-14 16:13 ` Lino Sanfilippo
2022-02-14 7:06 ` Uwe Kleine-König
2022-02-14 15:09 ` Lino Sanfilippo [this message]
2022-02-14 18:23 ` Uwe Kleine-König
2022-02-13 22:27 ` [PATCH 2/9] serial: amba-pl011: remove redundant code in rs485_config Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 3/9] serial: stm32: " Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 4/9] serial: sc16is7xx: " Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 5/9] serial: omap: " Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 6/9] serial: max310: " Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 7/9] serial: imx: remove redundant assignment " Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Lino Sanfilippo
2022-02-13 22:27 ` [PATCH 9/9] serial: atmel: remove redundant assignment in rs485_config Lino Sanfilippo
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=edbb9e1d-bed4-0850-08f4-029c4fcbfd5c@gmx.de \
--to=linosanfilippo@gmx.de \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=ludovic.desroches@microchip.com \
--cc=lukas@wunner.de \
--cc=mcoquelin.stm32@gmail.com \
--cc=nicolas.ferre@microchip.com \
--cc=richard.genoud@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--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 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).