From: Christophe JAILLET Date: Sat, 10 Jun 2023 15:59:27 +0000 (+0200) Subject: tty: serial: samsung_tty: Use abs() to simplify some code X-Git-Tag: v6.6.7~2447^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3710f5e9e1a68da53202cffba73f4b604f05b15;p=platform%2Fkernel%2Flinux-starfive.git tty: serial: samsung_tty: Use abs() to simplify some code Use abs() instead of hand-writing it. Suggested-by: Walter Harms Signed-off-by: Christophe JAILLET Reviewed-by: Andi Shyti Reviewed-by: Jiri Slaby Message-ID: <7bd165e82ed3675d4ddee343ab373031e995a126.1686412569.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 0b37019..b29e9df 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1485,9 +1486,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, } quot--; - calc_deviation = req_baud - baud; - if (calc_deviation < 0) - calc_deviation = -calc_deviation; + calc_deviation = abs(req_baud - baud); if (calc_deviation < deviation) { /*