Skip to content

Commit

Permalink
serial: imx: Grab port lock in imx_uart_enable_wakeup()
Browse files Browse the repository at this point in the history
The port lock needs to be held when doing read-modify-write on UCR1 and
UCR3.

Signed-off-by: Esben Haabendal <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
esben authored and gregkh committed Oct 11, 2024
1 parent 5cbb9b1 commit 3c199ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2580,10 +2580,13 @@ static void imx_uart_save_context(struct imx_port *sport)
uart_port_unlock_irqrestore(&sport->port, flags);
}

/* called with irq off */
static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
{
u32 ucr3;

uart_port_lock(&sport->port);

ucr3 = imx_uart_readl(sport, UCR3);
if (on) {
imx_uart_writel(sport, USR1_AWAKE, USR1);
Expand All @@ -2603,6 +2606,8 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
}
imx_uart_writel(sport, ucr1, UCR1);
}

uart_port_unlock(&sport->port);
}

static int imx_uart_suspend_noirq(struct device *dev)
Expand Down

0 comments on commit 3c199ed

Please sign in to comment.