lkml.org 
[lkml]   [2022]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] serial: 8250_bcm7271: Save/restore RTS in suspend/resume
From


On 7/3/2022 11:40 PM, Jiri Slaby wrote:
> On 29. 06. 22, 18:02, Florian Fainelli wrote:
>> From: Doug Berger <opendmb@gmail.com>
>>
>> Commit 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming
>> from S2") prevented an early enabling of RTS during resume, but it did
>> not actively restore the RTS state after resume.
>>
>> Fixes: 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming
>> from S2")
>> Signed-off-by: Doug Berger <opendmb@gmail.com>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>   drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------
>>   1 file changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_bcm7271.c
>> b/drivers/tty/serial/8250/8250_bcm7271.c
>> index 9b878d023dac..b9cea38c8aff 100644
>> --- a/drivers/tty/serial/8250/8250_bcm7271.c
>> +++ b/drivers/tty/serial/8250/8250_bcm7271.c
> ...
>> @@ -1180,7 +1184,15 @@ static int __maybe_unused
>> brcmuart_resume(struct device *dev)
>>           start_rx_dma(serial8250_get_port(priv->line));
>>       }
>>       serial8250_resume_port(priv->line);
>> -    port->mctrl = priv->saved_mctrl;
>> +
>> +    if (priv->saved_mctrl & TIOCM_RTS) {
>> +        /* Restore RTS */
>> +        spin_lock_irqsave(&port->lock, flags);
>> +        port->mctrl |= TIOCM_RTS;
>> +        spin_unlock_irqrestore(&port->lock, flags);
>> +        port->ops->set_mctrl(port, port->mctrl);
>
> Calling ->set_mctrl w/o port->lock doesn't look really safe.

Good point, I will check with Doug whether this was intentional and if
so, why, and if not why should we move it up under the spinlock.

Thanks!
--
Florian

\
 
 \ /
  Last update: 2022-07-04 17:37    [W:0.062 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site