[PATCH 1/3] serial: pl011: Request the irq inside the probe function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>

Instead of requesting the irq in pl011_startup() and then freeing it on 
pl011_shutdown(), we can simply request it inside the probe function, which
makes the code simpler as we do not need to free it.

Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
---
 drivers/tty/serial/amba-pl011.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8d94c19..7dbe4fe 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1586,13 +1586,6 @@ static int pl011_startup(struct uart_port *port)
 
 	writew(uap->im, uap->port.membase + UART011_IMSC);
 
-	/*
-	 * Allocate the IRQ
-	 */
-	retval = request_irq(uap->port.irq, pl011_int, 0, "uart-pl011", uap);
-	if (retval)
-		goto clk_dis;
-
 	writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS);
 
 	/*
@@ -1684,11 +1677,6 @@ static void pl011_shutdown(struct uart_port *port)
 	pl011_dma_shutdown(uap);
 
 	/*
-	 * Free the interrupt
-	 */
-	free_irq(uap->port.irq, uap);
-
-	/*
 	 * disable the port
 	 * disable the port. It should not disable RTS and DTR.
 	 * Also RTS and DTR state should be preserved to restore
@@ -2224,6 +2212,11 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
 	writew(0, uap->port.membase + UART011_IMSC);
 	writew(0xffff, uap->port.membase + UART011_ICR);
 
+	ret = devm_request_irq(&dev->dev, uap->port.irq, pl011_int, 0,
+			       "uart-pl011", uap);
+	if (ret)
+		return ret;
+
 	snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev));
 
 	amba_ports[i] = uap;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux