Skip to content

Commit f3710f5

Browse files
tititiou36gregkh
authored andcommitted
tty: serial: samsung_tty: Use abs() to simplify some code
Use abs() instead of hand-writing it. Suggested-by: Walter Harms <wharms@bfs.de> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Message-ID: <7bd165e82ed3675d4ddee343ab373031e995a126.1686412569.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 832e231 commit f3710f5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/tty/serial/samsung_tty.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/dmaengine.h>
2525
#include <linux/dma-mapping.h>
2626
#include <linux/slab.h>
27+
#include <linux/math.h>
2728
#include <linux/module.h>
2829
#include <linux/ioport.h>
2930
#include <linux/io.h>
@@ -1485,9 +1486,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
14851486
}
14861487
quot--;
14871488

1488-
calc_deviation = req_baud - baud;
1489-
if (calc_deviation < 0)
1490-
calc_deviation = -calc_deviation;
1489+
calc_deviation = abs(req_baud - baud);
14911490

14921491
if (calc_deviation < deviation) {
14931492
/*

0 commit comments

Comments
 (0)