Skip to content

Commit cc56884

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
serial: imx: reorder functions and simplify a bit
Now that imx_mctrl_check is implemented below imx_get_mctrl the former can call the latter directly instead of via sport->port.ops->get_mctrl. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 90ebc48 commit cc56884

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

drivers/tty/serial/imx.c

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -311,51 +311,6 @@ static void imx_port_ucrs_restore(struct uart_port *port,
311311
}
312312
#endif
313313

314-
/*
315-
* Handle any change of modem status signal since we were last called.
316-
*/
317-
static void imx_mctrl_check(struct imx_port *sport)
318-
{
319-
unsigned int status, changed;
320-
321-
status = sport->port.ops->get_mctrl(&sport->port);
322-
changed = status ^ sport->old_status;
323-
324-
if (changed == 0)
325-
return;
326-
327-
sport->old_status = status;
328-
329-
if (changed & TIOCM_RI)
330-
sport->port.icount.rng++;
331-
if (changed & TIOCM_DSR)
332-
sport->port.icount.dsr++;
333-
if (changed & TIOCM_CAR)
334-
uart_handle_dcd_change(&sport->port, status & TIOCM_CAR);
335-
if (changed & TIOCM_CTS)
336-
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
337-
338-
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
339-
}
340-
341-
/*
342-
* This is our per-port timeout handler, for checking the
343-
* modem status signals.
344-
*/
345-
static void imx_timeout(unsigned long data)
346-
{
347-
struct imx_port *sport = (struct imx_port *)data;
348-
unsigned long flags;
349-
350-
if (sport->port.state) {
351-
spin_lock_irqsave(&sport->port.lock, flags);
352-
imx_mctrl_check(sport);
353-
spin_unlock_irqrestore(&sport->port.lock, flags);
354-
355-
mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
356-
}
357-
}
358-
359314
/*
360315
* interrupts disabled on entry
361316
*/
@@ -868,6 +823,51 @@ static void imx_break_ctl(struct uart_port *port, int break_state)
868823
spin_unlock_irqrestore(&sport->port.lock, flags);
869824
}
870825

826+
/*
827+
* Handle any change of modem status signal since we were last called.
828+
*/
829+
static void imx_mctrl_check(struct imx_port *sport)
830+
{
831+
unsigned int status, changed;
832+
833+
status = imx_get_mctrl(&sport->port);
834+
changed = status ^ sport->old_status;
835+
836+
if (changed == 0)
837+
return;
838+
839+
sport->old_status = status;
840+
841+
if (changed & TIOCM_RI)
842+
sport->port.icount.rng++;
843+
if (changed & TIOCM_DSR)
844+
sport->port.icount.dsr++;
845+
if (changed & TIOCM_CAR)
846+
uart_handle_dcd_change(&sport->port, status & TIOCM_CAR);
847+
if (changed & TIOCM_CTS)
848+
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
849+
850+
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
851+
}
852+
853+
/*
854+
* This is our per-port timeout handler, for checking the
855+
* modem status signals.
856+
*/
857+
static void imx_timeout(unsigned long data)
858+
{
859+
struct imx_port *sport = (struct imx_port *)data;
860+
unsigned long flags;
861+
862+
if (sport->port.state) {
863+
spin_lock_irqsave(&sport->port.lock, flags);
864+
imx_mctrl_check(sport);
865+
spin_unlock_irqrestore(&sport->port.lock, flags);
866+
867+
mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
868+
}
869+
}
870+
871871
#define RX_BUF_SIZE (PAGE_SIZE)
872872
static void imx_rx_dma_done(struct imx_port *sport)
873873
{

0 commit comments

Comments
 (0)