[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d25d1d33-6a10-4e23-5ab2-f02ed4b72fac@huawei.com>
Date: Mon, 5 Feb 2024 17:00:11 +0800
From: Yicong Yang <yangyicong@...wei.com>
To: John Ogness <john.ogness@...utronix.de>
CC: <gregkh@...uxfoundation.org>, <jirislaby@...nel.org>, <tony@...mide.com>,
<linux-kernel@...r.kernel.org>, <linux-serial@...r.kernel.org>,
<yangyicong@...ilicon.com>, <andriy.shevchenko@...ux.intel.com>,
<tglx@...utronix.de>, <linuxarm@...wei.com>, <prime.zeng@...ilicon.com>,
<jonathan.cameron@...wei.com>, <fanghao11@...wei.com>
Subject: Re: [PATCH] serial: port: Don't suspend if the port is still busy
On 2024/2/5 16:47, John Ogness wrote:
> On 2024-02-04, Yicong Yang <yangyicong@...wei.com> wrote:
>> diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c
>> index 88975a4df306..60d1eec6b6b7 100644
>> --- a/drivers/tty/serial/serial_port.c
>> +++ b/drivers/tty/serial/serial_port.c
>> @@ -46,8 +46,28 @@ static int serial_port_runtime_resume(struct device *dev)
>> return 0;
>> }
>>
>> +static int serial_port_runtime_suspend(struct device *dev)
>> +{
>> + struct serial_port_device *port_dev = to_serial_base_port_device(dev);
>> + struct uart_port *port;
>> + unsigned long flags;
>> +
>> + port = port_dev->port;
>> +
>> + if (port->flags & UPF_DEAD)
>> + return 0;
>> +
>> + spin_lock_irqsave(&port->lock, flags);
>> + if (__serial_port_busy(port))
>> + pm_request_resume(dev);
>> + spin_unlock_irqrestore(&port->lock, flags);
>
> Please use the wrapper functions for the uart port lock:
>
> uart_port_lock_irqsave()
> uart_port_unlock_irqrestore()
>
Sure. Thanks for the information.
Powered by blists - more mailing lists