linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod
@ 2014-04-05 14:31 Guennadi Liakhovetski
  2014-04-05 15:19 ` Russell King - ARM Linux
  2014-04-14  7:25 ` Tushar Behera
  0 siblings, 2 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2014-04-05 14:31 UTC (permalink / raw)
  To: linux-arm-kernel

A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011:
Move uart_register_driver call to device probe" introduced a regression,
causing the pl011 driver to Oops if more than 1 port have been probed. Fix
the Oops by only calling uart_unregister_driver() once after the last port
has been removed.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/tty/serial/amba-pl011.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index d4eda24..07325f2 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
 static int pl011_remove(struct amba_device *dev)
 {
 	struct uart_amba_port *uap = amba_get_drvdata(dev);
+	bool busy = false;
 	int i;
 
 	uart_remove_one_port(&amba_reg, &uap->port);
@@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev)
 	for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
 		if (amba_ports[i] == uap)
 			amba_ports[i] = NULL;
+		else if (amba_ports[i])
+			busy = true;
 
 	pl011_dma_remove(uap);
-	uart_unregister_driver(&amba_reg);
+	if (!busy)
+		uart_unregister_driver(&amba_reg);
 	return 0;
 }
 
-- 
1.9.1

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

* [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod
  2014-04-05 14:31 [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod Guennadi Liakhovetski
@ 2014-04-05 15:19 ` Russell King - ARM Linux
  2014-04-14  7:25 ` Tushar Behera
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2014-04-05 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

ROTFL.  What did I say about this solution... seems I was right all
along.

On Sat, Apr 05, 2014 at 04:31:08PM +0200, Guennadi Liakhovetski wrote:
> A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011:
> Move uart_register_driver call to device probe" introduced a regression,
> causing the pl011 driver to Oops if more than 1 port have been probed. Fix
> the Oops by only calling uart_unregister_driver() once after the last port
> has been removed.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/tty/serial/amba-pl011.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index d4eda24..07325f2 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>  static int pl011_remove(struct amba_device *dev)
>  {
>  	struct uart_amba_port *uap = amba_get_drvdata(dev);
> +	bool busy = false;
>  	int i;
>  
>  	uart_remove_one_port(&amba_reg, &uap->port);
> @@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev)
>  	for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
>  		if (amba_ports[i] == uap)
>  			amba_ports[i] = NULL;
> +		else if (amba_ports[i])
> +			busy = true;
>  
>  	pl011_dma_remove(uap);
> -	uart_unregister_driver(&amba_reg);
> +	if (!busy)
> +		uart_unregister_driver(&amba_reg);
>  	return 0;
>  }
>  
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

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

* [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod
  2014-04-05 14:31 [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod Guennadi Liakhovetski
  2014-04-05 15:19 ` Russell King - ARM Linux
@ 2014-04-14  7:25 ` Tushar Behera
  1 sibling, 0 replies; 3+ messages in thread
From: Tushar Behera @ 2014-04-14  7:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 5 April 2014 20:01, Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011:
> Move uart_register_driver call to device probe" introduced a regression,
> causing the pl011 driver to Oops if more than 1 port have been probed. Fix
> the Oops by only calling uart_unregister_driver() once after the last port
> has been removed.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Sorry about this. There were some additional suggestion in following
thread [1] about registering it once during first probe and then
unregistering during the last remove.

[1] http://linux-kernel.2935.n7.nabble.com/PATCH-0-2-serial-Move-uart-register-driver-call-to-device-probe-td789746.html#a790221

> ---
>  drivers/tty/serial/amba-pl011.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index d4eda24..07325f2 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>  static int pl011_remove(struct amba_device *dev)
>  {
>         struct uart_amba_port *uap = amba_get_drvdata(dev);
> +       bool busy = false;
>         int i;
>
>         uart_remove_one_port(&amba_reg, &uap->port);
> @@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev)
>         for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
>                 if (amba_ports[i] == uap)
>                         amba_ports[i] = NULL;
> +               else if (amba_ports[i])
> +                       busy = true;
>
>         pl011_dma_remove(uap);
> -       uart_unregister_driver(&amba_reg);
> +       if (!busy)
> +               uart_unregister_driver(&amba_reg);
>         return 0;
>  }
>
> --
> 1.9.1
>



-- 
Tushar Behera

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

end of thread, other threads:[~2014-04-14  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-05 14:31 [PATCH] serial: amba-pl011: fix regression, causing an Oops on rmmod Guennadi Liakhovetski
2014-04-05 15:19 ` Russell King - ARM Linux
2014-04-14  7:25 ` Tushar Behera

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).