Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1306915
| From | Soren Brinkmann <soren.brinkmann@xilinx.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH LINUX 1/6] tty: xuartps: Move request_irq to after setting up the HW |
| Date | 2016-01-12 02:50 +0100 |
| Message-ID | <qPWfU-2p4-27@gated-at.bofh.it> (permalink) |
| References | <qPWfT-2p4-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Request_irq() should be _after_ h/w programming, otherwise an
interrupt could be triggered and in-progress before the h/w has been
setup.
Reported-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/tty/serial/xilinx_uartps.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index db9e23eaf300..5da1c51e9e40 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -762,13 +762,9 @@ static void cdns_uart_set_termios(struct uart_port *port,
*/
static int cdns_uart_startup(struct uart_port *port)
{
+ int ret;
unsigned long flags;
- unsigned int retval = 0, status = 0;
-
- retval = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME,
- (void *)port);
- if (retval)
- return retval;
+ unsigned int status = 0;
spin_lock_irqsave(&port->lock, flags);
@@ -814,15 +810,22 @@ static int cdns_uart_startup(struct uart_port *port)
writel(readl(port->membase + CDNS_UART_ISR_OFFSET),
port->membase + CDNS_UART_ISR_OFFSET);
+ spin_unlock_irqrestore(&port->lock, flags);
+
+ ret = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME, port);
+ if (ret) {
+ dev_err(port->dev, "request_irq '%d' failed with %d\n",
+ port->irq, ret);
+ return ret;
+ }
+
/* Set the Interrupt Registers with desired interrupts */
writel(CDNS_UART_IXR_TXEMPTY | CDNS_UART_IXR_PARITY |
CDNS_UART_IXR_FRAMING | CDNS_UART_IXR_OVERRUN |
CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT,
port->membase + CDNS_UART_IER_OFFSET);
- spin_unlock_irqrestore(&port->lock, flags);
-
- return retval;
+ return 0;
}
/**
--
2.7.0.3.g497ea1e
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH LINUX 0/6] Second part of xuartps fixes Soren Brinkmann <soren.brinkmann@xilinx.com> - 2016-01-12 02:50 +0100 [PATCH LINUX 5/6] tty: xuartps: Remove '_OFFSET' suffix from #defines Soren Brinkmann <soren.brinkmann@xilinx.com> - 2016-01-12 02:50 +0100 [PATCH LINUX 1/6] tty: xuartps: Move request_irq to after setting up the HW Soren Brinkmann <soren.brinkmann@xilinx.com> - 2016-01-12 02:50 +0100
csiph-web