Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250: Switch to use hrtimer_setup()

hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/991926d130cc272df30d226760d5d74187991669.1738746904.git.namcao@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nam Cao and committed by
Greg Kroah-Hartman
d45545c3 a2d1afe6

+5 -8
+1 -2
drivers/tty/serial/8250/8250_bcm7271.c
··· 1056 1056 } 1057 1057 1058 1058 /* setup HR timer */ 1059 - hrtimer_init(&priv->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 1060 - priv->hrt.function = brcmuart_hrtimer_func; 1059 + hrtimer_setup(&priv->hrt, brcmuart_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 1061 1060 1062 1061 up.port.shutdown = brcmuart_shutdown; 1063 1062 up.port.startup = brcmuart_startup;
+4 -6
drivers/tty/serial/8250/8250_port.c
··· 566 566 if (!p->em485) 567 567 return -ENOMEM; 568 568 569 - hrtimer_init(&p->em485->stop_tx_timer, CLOCK_MONOTONIC, 570 - HRTIMER_MODE_REL); 571 - hrtimer_init(&p->em485->start_tx_timer, CLOCK_MONOTONIC, 572 - HRTIMER_MODE_REL); 573 - p->em485->stop_tx_timer.function = &serial8250_em485_handle_stop_tx; 574 - p->em485->start_tx_timer.function = &serial8250_em485_handle_start_tx; 569 + hrtimer_setup(&p->em485->stop_tx_timer, &serial8250_em485_handle_stop_tx, CLOCK_MONOTONIC, 570 + HRTIMER_MODE_REL); 571 + hrtimer_setup(&p->em485->start_tx_timer, &serial8250_em485_handle_start_tx, CLOCK_MONOTONIC, 572 + HRTIMER_MODE_REL); 575 573 p->em485->port = p; 576 574 p->em485->active_timer = NULL; 577 575 p->em485->tx_stopped = true;