linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485
@ 2019-06-04  9:54 Borut Seljak
       [not found] ` <f2a264ac-e334-63b7-18c9-e45cde7bdf95@st.com>
  2019-06-04 16:14 ` [PATCH v2] " Borut Seljak
  0 siblings, 2 replies; 5+ messages in thread
From: Borut Seljak @ 2019-06-04  9:54 UTC (permalink / raw)
  Cc: borut.seljak, Greg Kroah-Hartman, Jiri Slaby, Maxime Coquelin,
	Alexandre Torgue, linux-serial, linux-stm32, linux-arm-kernel,
	linux-kernel

Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive locking.
Already locked in uart_set_rs485_config.

Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
---
 drivers/tty/serial/stm32-usart.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index e8d7a7bb4339..da373a465f51 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -107,7 +107,6 @@ static int stm32_config_rs485(struct uart_port *port,
 	bool over8;
 	unsigned long flags;
 
-	spin_lock_irqsave(&port->lock, flags);
 	stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
 
 	port->rs485 = *rs485conf;
@@ -147,7 +146,6 @@ static int stm32_config_rs485(struct uart_port *port,
 	}
 
 	stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
-	spin_unlock_irqrestore(&port->lock, flags);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Fwd: [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485
       [not found] ` <f2a264ac-e334-63b7-18c9-e45cde7bdf95@st.com>
@ 2019-06-04 13:41   ` Erwan LE RAY
  2019-06-04 13:55     ` Erwan LE RAY
  0 siblings, 1 reply; 5+ messages in thread
From: Erwan LE RAY @ 2019-06-04 13:41 UTC (permalink / raw)
  To: Borut Seljak, Maxime Coquelin, Alexandre TORGUE,
	Greg Kroah-Hartman, linux-kernel, linux-serial, Jiri Slaby,
	linux-stm32, ; linux-arm-kernel

Hi Borut,

Please add the following line in the commit message (before your 
sign-off) in a V2 of your patch:

fixes: 1bcda09d291081 ("serial: stm32: add support for RS485 hardware 
control mode")

I'm OK with the patch itself.

Erwan.


Subject: [PATCH] serial: stm32: fix a recursive locking in
> stm32_config_rs485
> Date: Tue,  4 Jun 2019 11:54:51 +0200
> From: Borut Seljak <borut.seljak@t-2.net>
> CC: Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue
> <alexandre.torgue@st.com>, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org,
> borut.seljak@t-2.net, linux-serial@vger.kernel.org, Jiri Slaby
> <jslaby@suse.com>, linux-stm32@st-md-mailman.stormreply.com,
> linux-arm-kernel@lists.infradead.org
>
> Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive locking.
> Already locked in uart_set_rs485_config.
>
> Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
> ---
>   drivers/tty/serial/stm32-usart.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/tty/serial/stm32-usart.c
> b/drivers/tty/serial/stm32-usart.c
> index e8d7a7bb4339..da373a465f51 100644
> --- a/drivers/tty/serial/stm32-usart.c
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -107,7 +107,6 @@ static int stm32_config_rs485(struct uart_port *port,
>   	bool over8;
>   	unsigned long flags;
>   -	spin_lock_irqsave(&port->lock, flags);
>   	stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
>    	port->rs485 = *rs485conf;
> @@ -147,7 +146,6 @@ static int stm32_config_rs485(struct uart_port *port,
>   	}
>    	stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
> -	spin_unlock_irqrestore(&port->lock, flags);
>    	return 0;
>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fwd: [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485
  2019-06-04 13:41   ` Fwd: " Erwan LE RAY
@ 2019-06-04 13:55     ` Erwan LE RAY
  2019-06-06  7:42       ` Erwan LE RAY
  0 siblings, 1 reply; 5+ messages in thread
From: Erwan LE RAY @ 2019-06-04 13:55 UTC (permalink / raw)
  To: Borut Seljak, Maxime Coquelin, Alexandre TORGUE,
	Greg Kroah-Hartman, linux-kernel, linux-serial, Jiri Slaby,
	linux-stm32, linux-arm-kernel


> Hi Borut,
>
> Please add the following line in the commit message (before your 
> sign-off) in a V2 of your patch:
>
> fixes: 1bcda09d291081 ("serial: stm32: add support for RS485 hardware 
> control mode")
>
> I'm OK with the patch itself.
>
> Erwan.
>
>
> Subject: [PATCH] serial: stm32: fix a recursive locking in
>> stm32_config_rs485
>> Date: Tue,  4 Jun 2019 11:54:51 +0200
>> From: Borut Seljak <borut.seljak@t-2.net>
>> CC: Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue
>> <alexandre.torgue@st.com>, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org,
>> borut.seljak@t-2.net, linux-serial@vger.kernel.org, Jiri Slaby
>> <jslaby@suse.com>, linux-stm32@st-md-mailman.stormreply.com,
>> linux-arm-kernel@lists.infradead.org
>>
>> Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive 
>> locking.
>> Already locked in uart_set_rs485_config.
>>
>> Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
>> ---
>>   drivers/tty/serial/stm32-usart.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/stm32-usart.c
>> b/drivers/tty/serial/stm32-usart.c
>> index e8d7a7bb4339..da373a465f51 100644
>> --- a/drivers/tty/serial/stm32-usart.c
>> +++ b/drivers/tty/serial/stm32-usart.c
>> @@ -107,7 +107,6 @@ static int stm32_config_rs485(struct uart_port 
>> *port,
>>       bool over8;
>>       unsigned long flags;
>>   -    spin_lock_irqsave(&port->lock, flags);
>>       stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
>>        port->rs485 = *rs485conf;
>> @@ -147,7 +146,6 @@ static int stm32_config_rs485(struct uart_port 
>> *port,
>>       }
>>        stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
>> -    spin_unlock_irqrestore(&port->lock, flags);
>>        return 0;
>>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] serial: stm32: fix a recursive locking in stm32_config_rs485
  2019-06-04  9:54 [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485 Borut Seljak
       [not found] ` <f2a264ac-e334-63b7-18c9-e45cde7bdf95@st.com>
@ 2019-06-04 16:14 ` Borut Seljak
  1 sibling, 0 replies; 5+ messages in thread
From: Borut Seljak @ 2019-06-04 16:14 UTC (permalink / raw)
  To: borut.seljak
  Cc: Greg Kroah-Hartman, Jiri Slaby, Maxime Coquelin,
	Alexandre Torgue, linux-serial, linux-stm32, linux-arm-kernel,
	linux-kernel

Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive locking.
Already locked in uart_set_rs485_config.

fixes: 1bcda09d291081 ("serial: stm32: add support for RS485 hardware control mode")

Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
---
 drivers/tty/serial/stm32-usart.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index e8d7a7bb4339..da373a465f51 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -107,7 +107,6 @@ static int stm32_config_rs485(struct uart_port *port,
 	bool over8;
 	unsigned long flags;
 
-	spin_lock_irqsave(&port->lock, flags);
 	stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
 
 	port->rs485 = *rs485conf;
@@ -147,7 +146,6 @@ static int stm32_config_rs485(struct uart_port *port,
 	}
 
 	stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
-	spin_unlock_irqrestore(&port->lock, flags);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Fwd: [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485
  2019-06-04 13:55     ` Erwan LE RAY
@ 2019-06-06  7:42       ` Erwan LE RAY
  0 siblings, 0 replies; 5+ messages in thread
From: Erwan LE RAY @ 2019-06-06  7:42 UTC (permalink / raw)
  To: Borut Seljak
  Cc: Maxime Coquelin, Alexandre TORGUE, Greg Kroah-Hartman,
	linux-kernel, linux-serial, Jiri Slaby, linux-stm32,
	linux-arm-kernel

Hi Borut,

Please remove unused "flags" variable declaration.

Erwan.


On 6/4/19 3:55 PM, Erwan LE RAY wrote:
>
>> Hi Borut,
>>
>> Please add the following line in the commit message (before your 
>> sign-off) in a V2 of your patch:
>>
>> Fixes: 1bcda09d291081 ("serial: stm32: add support for RS485 hardware 
>> control mode")
>>
>> I'm OK with the patch itself.
>>
>> Erwan.
>>
>>
>> Subject: [PATCH] serial: stm32: fix a recursive locking in
>>> stm32_config_rs485
>>> Date: Tue,  4 Jun 2019 11:54:51 +0200
>>> From: Borut Seljak <borut.seljak@t-2.net>
>>> CC: Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue
>>> <alexandre.torgue@st.com>, Greg Kroah-Hartman
>>> <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org,
>>> borut.seljak@t-2.net, linux-serial@vger.kernel.org, Jiri Slaby
>>> <jslaby@suse.com>, linux-stm32@st-md-mailman.stormreply.com,
>>> linux-arm-kernel@lists.infradead.org
>>>
>>> Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive 
>>> locking.
>>> Already locked in uart_set_rs485_config.
>>>
>>> Signed-off-by: Borut Seljak <borut.seljak@t-2.net>
>>> ---
>>>   drivers/tty/serial/stm32-usart.c | 2 --
>>>   1 file changed, 2 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/stm32-usart.c
>>> b/drivers/tty/serial/stm32-usart.c
>>> index e8d7a7bb4339..da373a465f51 100644
>>> --- a/drivers/tty/serial/stm32-usart.c
>>> +++ b/drivers/tty/serial/stm32-usart.c
>>> @@ -107,7 +107,6 @@ static int stm32_config_rs485(struct uart_port 
>>> *port,
>>>       bool over8;
>>>       unsigned long flags;
- unsigned long flags;
>>>   - spin_lock_irqsave(&port->lock, flags);
>>>       stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
>>>        port->rs485 = *rs485conf;
>>> @@ -147,7 +146,6 @@ static int stm32_config_rs485(struct uart_port 
>>> *port,
>>>       }
>>>        stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
>>> -    spin_unlock_irqrestore(&port->lock, flags);
>>>        return 0;
>>>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-06  7:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04  9:54 [PATCH] serial: stm32: fix a recursive locking in stm32_config_rs485 Borut Seljak
     [not found] ` <f2a264ac-e334-63b7-18c9-e45cde7bdf95@st.com>
2019-06-04 13:41   ` Fwd: " Erwan LE RAY
2019-06-04 13:55     ` Erwan LE RAY
2019-06-06  7:42       ` Erwan LE RAY
2019-06-04 16:14 ` [PATCH v2] " Borut Seljak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).