Skip to content

Commit d45545c

Browse files
covanamgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Nam Cao <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/991926d130cc272df30d226760d5d74187991669.1738746904.git.namcao@linutronix.de Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a2d1afe commit d45545c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

drivers/tty/serial/8250/8250_bcm7271.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,7 @@ static int brcmuart_probe(struct platform_device *pdev)
10561056
}
10571057

10581058
/* 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);
10611060

10621061
up.port.shutdown = brcmuart_shutdown;
10631062
up.port.startup = brcmuart_startup;

drivers/tty/serial/8250/8250_port.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,10 @@ static int serial8250_em485_init(struct uart_8250_port *p)
566566
if (!p->em485)
567567
return -ENOMEM;
568568

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);
575573
p->em485->port = p;
576574
p->em485->active_timer = NULL;
577575
p->em485->tx_stopped = true;

0 commit comments

Comments
 (0)