[PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()

Nam Cao posted 45 patches 10 months, 1 week ago
[PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()
Posted by Nam Cao 10 months, 1 week ago
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: Jassi Brar <jassisinghbrar@gmail.com>
---
 drivers/mailbox/mailbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index d3d26a2c9895..118beaf447aa 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -534,9 +534,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
 			return -EINVAL;
 		}
 
-		hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL);
-		mbox->poll_hrt.function = txdone_hrtimer;
+		hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		spin_lock_init(&mbox->poll_hrt_lock);
 	}
 
-- 
2.39.5
Re: [PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()
Posted by Jassi Brar 9 months, 2 weeks ago
On Wed, Feb 5, 2025 at 4:47 AM Nam Cao <namcao@linutronix.de> wrote:
>
> 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: Jassi Brar <jassisinghbrar@gmail.com>
> ---
>  drivers/mailbox/mailbox.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index d3d26a2c9895..118beaf447aa 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -534,9 +534,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
>                         return -EINVAL;
>                 }
>
> -               hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
> -                            HRTIMER_MODE_REL);
> -               mbox->poll_hrt.function = txdone_hrtimer;
> +               hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>                 spin_lock_init(&mbox->poll_hrt_lock);
>         }
>
Applied. Thanks.