Re: [PATCH v7 6/7] serial: omap: do not override settings for RS485 support

From: Lino Sanfilippo
Date: Fri Jan 05 2024 - 07:44:23 EST


On 03.01.24 at 12:36, Ilpo Järvinen wrote:
> On Wed, 3 Jan 2024, Lino Sanfilippo wrote:
>
>> The drivers RS485 support is deactivated if there is no RTS GPIO available.
>> This is done by nullifying the ports rs485_supported struct. After that
>> however the settings in serial_omap_rs485_supported are assigned to the
>> same structure unconditionally, which results in an unintended reactivation
>> of RS485 support.
>>
>> Fix this by moving the assignment to the beginning of
>> serial_omap_probe_rs485() and thus before uart_get_rs485_mode() gets
>> called.
>
> This doesn't seem to accurately reflect what the problem is (which you
> correctly described in the paragraph above this). The problem doesn't seem
> to have anything to do with the placement of uart_get_rs485_mode() call
> but the if (IS_ERR(up->rts_gpiod)) block that clears rs485_supported?
>

Right, this should be "...Fix this by moving the assignment to the beginning of
serial_omap_probe_rs485() and thus before the check for the RTS GPIO."
I will correct this.


> A future work item that came to my mind while reviewing this: I suppose
> uart_disable_rs485_support() could be added into core which memsets
> rs485_supported and rs485 to zero so this driver could just call it.
>

Yes, and the ar933x driver could use that as well.


Regards,
Lino