lkml.org 
[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/8] serial: core: only get RS485 termination gpio if supported
From
Date
On 23.06.22 at 18:32, Andy Shevchenko wrote:

>>
>> Ok I see the point. So what about changing it to:
>
> You mean adding below after the existing code in the module?

Right, to be more precise between getting the gpio and the error check:


port->rs485_term_gpio = devm_gpiod_get_optional(dev, "rs485-term",
GPIOD_OUT_LOW);

if (port->rs485_term_gpio &&
!(port->rs485_supported->flags & SER_RS485_TERMINATE_BUS)) {
dev_warn(port->dev,
"%s (%d): RS485 termination gpio not supported by driver\n",
port->name, port->line);
devm_gpiod_put(dev, port->rs485_term_gpio);
port->rs485_term_gpio = NULL;
}

if (IS_ERR(port->rs485_term_gpio)) {
ret = PTR_ERR(port->rs485_term_gpio);
port->rs485_term_gpio = NULL;
return dev_err_probe(dev, ret, "Cannot get rs485-term-gpios\n");
}

Regards,
Lino

>
>> if (port->rs485_term_gpio &&
>> !(port->rs485_supported->flags & SER_RS485_TERMINATE_BUS)) {
>> dev_warn(port->dev,
>> "%s (%d): RS485 termination gpio not supported by driver\n",
>> port->name, port->line);
>> devm_gpiod_put(dev, port->rs485_term_gpio);
>> port->rs485_term_gpio = NULL;
>> }
>>
>> This would also be consistent to the warnings we print in uart_sanitize_serial_rs485() for invalid
>> RS485 settings.
>
> Probably it's okay, but I dunno we have much on this to gain. Users may start
> complaining of this (harmless) warning. I leave it to others to comment.
>

\
 
 \ /
  Last update: 2022-06-23 22:20    [W:0.520 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site