]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
serial: sh-sci: Extract sci_dma_rx_reenable_irq()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 7 Jan 2019 16:23:18 +0000 (17:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Jan 2019 15:56:52 +0000 (16:56 +0100)
Extract the functionality to direct new serial port interrupts back to
the CPU into its own helper, to prepare for using it from a second
callsite.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index 4c75468680cb547deaa780af3ee62b4c966c9c58..4d814c30c4189b56041a1894dd25cfb2118d2331 100644 (file)
@@ -1274,6 +1274,20 @@ static void start_hrtimer_us(struct hrtimer *hrt, unsigned long usec)
        hrtimer_start(hrt, t, HRTIMER_MODE_REL);
 }
 
+static void sci_dma_rx_reenable_irq(struct sci_port *s)
+{
+       struct uart_port *port = &s->port;
+       u16 scr;
+
+       /* Direct new serial port interrupts back to CPU */
+       scr = serial_port_in(port, SCSCR);
+       if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
+               scr &= ~SCSCR_RDRQE;
+               enable_irq(s->irqs[SCIx_RXI_IRQ]);
+       }
+       serial_port_out(port, SCSCR, scr | SCSCR_RIE);
+}
+
 static void sci_dma_rx_complete(void *arg)
 {
        struct sci_port *s = arg;
@@ -1453,7 +1467,6 @@ static enum hrtimer_restart rx_timer_fn(struct hrtimer *t)
        unsigned long flags;
        unsigned int read;
        int active, count;
-       u16 scr;
 
        dev_dbg(port->dev, "DMA Rx timed out\n");
 
@@ -1503,13 +1516,7 @@ static enum hrtimer_restart rx_timer_fn(struct hrtimer *t)
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
                sci_submit_rx(s, true);
 
-       /* Direct new serial port interrupts back to CPU */
-       scr = serial_port_in(port, SCSCR);
-       if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
-               scr &= ~SCSCR_RDRQE;
-               enable_irq(s->irqs[SCIx_RXI_IRQ]);
-       }
-       serial_port_out(port, SCSCR, scr | SCSCR_RIE);
+       sci_dma_rx_reenable_irq(s);
 
        spin_unlock_irqrestore(&port->lock, flags);