Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1481292 > unrolled thread

[PATCH] BUG: atmel_serial: Interrupts not disabled on close

Started byRichard Genoud <richard.genoud@gmail.com>
First post2016-09-12 15:40 +0200
Last post2016-09-15 12:40 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] BUG: atmel_serial: Interrupts not disabled on close Richard Genoud <richard.genoud@gmail.com> - 2016-09-12 15:40 +0200
    Re: [PATCH] BUG: atmel_serial: Interrupts not disabled on close Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2016-09-12 16:20 +0200
    Re: [PATCH] BUG: atmel_serial: Interrupts not disabled on close Nicolas Ferre <nicolas.ferre@atmel.com> - 2016-09-12 17:30 +0200
      Re: [PATCH] BUG: atmel_serial: Interrupts not disabled on close Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-09-15 12:40 +0200

#1481292 — [PATCH] BUG: atmel_serial: Interrupts not disabled on close

FromRichard Genoud <richard.genoud@gmail.com>
Date2016-09-12 15:40 +0200
Subject[PATCH] BUG: atmel_serial: Interrupts not disabled on close
Message-ID<sgzCO-3Ue-21@gated-at.bofh.it>
Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
provided mctrl-gpio"), interrupts from GPIOs are not disabled any more
when the serial port is closed, leading to an oops when the one of the
input pin is toggled (CTS/DSR/DCD/RNG).

This is only the case if those pins are used as GPIOs, i.e. declared
like that:
usart1: serial@f8020000 {
        /* CTS and DTS will be handled by GPIO */
        status = "okay";
        rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
        cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
        dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
        dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
        rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
        dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
};

That's because modem interrupts used to be freed in atmel_shutdown().
After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
provided mctrl-gpio"), this code was just removed.
Calling atmel_disable_ms() disables the interrupts and everything works
fine again.

Tested on at91sam9g35-cm

(This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will
be sent after this one is applied.)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Fixes: 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")
---
 drivers/tty/serial/atmel_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2eaa18ddef61..8bbde52db376 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1929,6 +1929,9 @@ static void atmel_shutdown(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
+	/* Disable modem control lines interrupts */
+	atmel_disable_ms(port);
+
 	/* Disable interrupts at device level */
 	atmel_uart_writel(port, ATMEL_US_IDR, -1);
 
@@ -1979,8 +1982,6 @@ static void atmel_shutdown(struct uart_port *port)
 	 */
 	free_irq(port->irq, port);
 
-	atmel_port->ms_irq_enabled = false;
-
 	atmel_flush_buffer(port);
 }
 

[toc] | [next] | [standalone]


#1481337

FromUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date2016-09-12 16:20 +0200
Message-ID<sgAfv-4o0-1@gated-at.bofh.it>
In reply to#1481292
On Mon, Sep 12, 2016 at 03:34:41PM +0200, Richard Genoud wrote:
> Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> provided mctrl-gpio"), interrupts from GPIOs are not disabled any more
> when the serial port is closed, leading to an oops when the one of the
> input pin is toggled (CTS/DSR/DCD/RNG).
> 
> This is only the case if those pins are used as GPIOs, i.e. declared
> like that:
> usart1: serial@f8020000 {
>         /* CTS and DTS will be handled by GPIO */
>         status = "okay";
>         rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
>         cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
>         dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
>         dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
>         rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
>         dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
> };
> 
> That's because modem interrupts used to be freed in atmel_shutdown().
> After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> provided mctrl-gpio"), this code was just removed.
> Calling atmel_disable_ms() disables the interrupts and everything works
> fine again.
> 
> Tested on at91sam9g35-cm
> 
> (This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will
> be sent after this one is applied.)
AFAIK this is no reason to not put stable on Cc. If then
$stablemaintainer fails to backport the change, he will contact you.

> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> Fixes: 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks for caring
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[toc] | [prev] | [next] | [standalone]


#1481425

FromNicolas Ferre <nicolas.ferre@atmel.com>
Date2016-09-12 17:30 +0200
Message-ID<sgBlf-548-13@gated-at.bofh.it>
In reply to#1481292
Le 12/09/2016 à 15:34, Richard Genoud a écrit :
> Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> provided mctrl-gpio"), interrupts from GPIOs are not disabled any more
> when the serial port is closed, leading to an oops when the one of the
> input pin is toggled (CTS/DSR/DCD/RNG).
> 
> This is only the case if those pins are used as GPIOs, i.e. declared
> like that:
> usart1: serial@f8020000 {
>         /* CTS and DTS will be handled by GPIO */
>         status = "okay";
>         rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
>         cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
>         dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
>         dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
>         rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
>         dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
> };
> 
> That's because modem interrupts used to be freed in atmel_shutdown().
> After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> provided mctrl-gpio"), this code was just removed.
> Calling atmel_disable_ms() disables the interrupts and everything works
> fine again.
> 
> Tested on at91sam9g35-cm
> 
> (This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will
> be sent after this one is applied.)
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> Fixes: 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")

I thinks it's a bit late for "4.8-fixes".

Greg, tell me if you want that I add the Cc: stable tag to this patch
(as advised by Uwe) and re-send?

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks Richard!

Best regards,

> ---
>  drivers/tty/serial/atmel_serial.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2eaa18ddef61..8bbde52db376 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1929,6 +1929,9 @@ static void atmel_shutdown(struct uart_port *port)
>  {
>  	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
>  
> +	/* Disable modem control lines interrupts */
> +	atmel_disable_ms(port);
> +
>  	/* Disable interrupts at device level */
>  	atmel_uart_writel(port, ATMEL_US_IDR, -1);
>  
> @@ -1979,8 +1982,6 @@ static void atmel_shutdown(struct uart_port *port)
>  	 */
>  	free_irq(port->irq, port);
>  
> -	atmel_port->ms_irq_enabled = false;
> -
>  	atmel_flush_buffer(port);
>  }
>  
> 


-- 
Nicolas Ferre

[toc] | [prev] | [next] | [standalone]


#1483962

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-09-15 12:40 +0200
Message-ID<shCfg-5Oi-35@gated-at.bofh.it>
In reply to#1481425
On Mon, Sep 12, 2016 at 05:22:58PM +0200, Nicolas Ferre wrote:
> Le 12/09/2016 à 15:34, Richard Genoud a écrit :
> > Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> > provided mctrl-gpio"), interrupts from GPIOs are not disabled any more
> > when the serial port is closed, leading to an oops when the one of the
> > input pin is toggled (CTS/DSR/DCD/RNG).
> > 
> > This is only the case if those pins are used as GPIOs, i.e. declared
> > like that:
> > usart1: serial@f8020000 {
> >         /* CTS and DTS will be handled by GPIO */
> >         status = "okay";
> >         rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
> >         cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
> >         dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
> >         dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
> >         rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
> >         dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
> > };
> > 
> > That's because modem interrupts used to be freed in atmel_shutdown().
> > After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling
> > provided mctrl-gpio"), this code was just removed.
> > Calling atmel_disable_ms() disables the interrupts and everything works
> > fine again.
> > 
> > Tested on at91sam9g35-cm
> > 
> > (This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will
> > be sent after this one is applied.)
> > 
> > Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> > Fixes: 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")
> 
> I thinks it's a bit late for "4.8-fixes".
> 
> Greg, tell me if you want that I add the Cc: stable tag to this patch
> (as advised by Uwe) and re-send?

I'll add it, no worries.

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web