[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d6f6cbb9-e8d9-d69c-d722-231096464484@gmx.de>
Date: Sun, 26 Jun 2022 14:39:44 +0200
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: Lukas Wunner <lukas@...ner.de>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 22/36] serial: Sanitize rs485_struct
On 25.06.22 at 22:12, Lukas Wunner wrote:
> On Mon, Jun 06, 2022 at 01:04:19PM +0300, Ilpo Järvinen wrote:
>> - if (rs485->delay_rts_before_send > RS485_MAX_RTS_DELAY) {
>> + if (!port->rs485_supported->delay_rts_before_send) {
>> + if (rs485->delay_rts_before_send) {
>> + dev_warn_ratelimited(port->dev,
>> + "%s (%d): RTS delay before sending not supported\n",
>> + port->name, port->line);
>> + }
>> + rs485->delay_rts_before_send = 0;
>> + } else if (rs485->delay_rts_before_send > RS485_MAX_RTS_DELAY) {
>> rs485->delay_rts_before_send = RS485_MAX_RTS_DELAY;
>> dev_warn_ratelimited(port->dev,
>> "%s (%d): RTS delay before sending clamped to %u ms\n",
>> port->name, port->line, rs485->delay_rts_before_send);
>> }
>
> This series seems to set rs485_supported->delay_rts_before_send to 1
> in all drivers to indicate that a delay is supported.
>
> It would probably be smarter to define it as a maximum, i.e. drivers
> declare the supported maximum delay in their rs485_supported struct
> and the core can use that to clamp the value. Initially, all drivers
> may use RS485_MAX_RTS_DELAY. Some chips only support specific delays
> (multiples of the UART clock or baud clock). We can amend their
> drivers later according to their capabilities.
Agreed.
Regards,
Lino
Powered by blists - more mailing lists