serial: sh-sci: let timeout timer only run when DMA is scheduled
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 6 May 2024 11:40:19 +0000 (13:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 May 2024 10:48:33 +0000 (11:48 +0100)
commit0c9c1ea583f1b9887d248dc26f6921c4ae826b96
tree67200e17f0736c7f8138416764aebf408c529637
parent8efc440549087de41abadf62f4bde1d827135338
serial: sh-sci: let timeout timer only run when DMA is scheduled

The hrtimer for RXDMA timeout was unconditionally restarted in the RXDMA
complete handler ignoring the fact that setting up DMA may fail and PIO
is used instead. Explicitly stop the timer when DMA is completed and
only restart it when setting up DMA was successful. This makes the
intention of the timer much clearer, the driver easier to understand and
simplifies assumptions about the timer. The latter avoids race
conditions if these assumptions were not met or confused.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240506114016.30498-9-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c