]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: 8250: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:45:56 +0000 (11:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Feb 2025 14:38:28 +0000 (15:38 +0100)
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>
drivers/tty/serial/8250/8250_bcm7271.c
drivers/tty/serial/8250/8250_port.c

index d0b18358859e11f353d5b838cae18a390afe8c6e..742004d63c6f045bbc87d24993ab73af00a87418 100644 (file)
@@ -1056,8 +1056,7 @@ static int brcmuart_probe(struct platform_device *pdev)
        }
 
        /* setup HR timer */
-       hrtimer_init(&priv->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-       priv->hrt.function = brcmuart_hrtimer_func;
+       hrtimer_setup(&priv->hrt, brcmuart_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
        up.port.shutdown = brcmuart_shutdown;
        up.port.startup = brcmuart_startup;
index 886e40f680d4517f4e0bfe325429ce5629a8a6e3..3f256e96c7220dac4e06b9f4032576c2127dc996 100644 (file)
@@ -566,12 +566,10 @@ static int serial8250_em485_init(struct uart_8250_port *p)
        if (!p->em485)
                return -ENOMEM;
 
-       hrtimer_init(&p->em485->stop_tx_timer, CLOCK_MONOTONIC,
-                    HRTIMER_MODE_REL);
-       hrtimer_init(&p->em485->start_tx_timer, CLOCK_MONOTONIC,
-                    HRTIMER_MODE_REL);
-       p->em485->stop_tx_timer.function = &serial8250_em485_handle_stop_tx;
-       p->em485->start_tx_timer.function = &serial8250_em485_handle_start_tx;
+       hrtimer_setup(&p->em485->stop_tx_timer, &serial8250_em485_handle_stop_tx, CLOCK_MONOTONIC,
+                     HRTIMER_MODE_REL);
+       hrtimer_setup(&p->em485->start_tx_timer, &serial8250_em485_handle_start_tx, CLOCK_MONOTONIC,
+                     HRTIMER_MODE_REL);
        p->em485->port = p;
        p->em485->active_timer = NULL;
        p->em485->tx_stopped = true;