aboutsummaryrefslogtreecommitdiffstats
path: root/samples/livepatch/livepatch-shadow-mod.c
diff options
context:
space:
mode:
authorEaswar Hariharan <[email protected]>2024-12-10 22:02:49 +0000
committerAndrew Morton <[email protected]>2025-01-13 04:21:05 +0000
commit6d072c0ba332e2ecdf30c4b0a9de475fa778a8fb (patch)
tree9c357c5a4b140614d630c5c428b686c9c14d3424 /samples/livepatch/livepatch-shadow-mod.c
parentceph: convert timeouts to secs_to_jiffies() (diff)
downloadkernel-6d072c0ba332e2ecdf30c4b0a9de475fa778a8fb.tar.gz
kernel-6d072c0ba332e2ecdf30c4b0a9de475fa778a8fb.zip
livepatch: convert timeouts to secs_to_jiffies()
Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced secs_to_jiffies(). As the value here is a multiple of 1000, use secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication. This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with the following Coccinelle rules: @@ constant C; @@ - msecs_to_jiffies(C * 1000) + secs_to_jiffies(C) @@ constant C; @@ - msecs_to_jiffies(C * MSEC_PER_SEC) + secs_to_jiffies(C) Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-18-ddfefd7e9f2a@linux.microsoft.com Signed-off-by: Easwar Hariharan <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Anna-Maria Behnsen <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Daniel Mack <[email protected]> Cc: David Airlie <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dick Kennedy <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Haojian Zhuang <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ilya Dryomov <[email protected]> Cc: Jack Wang <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: James Bottomley <[email protected]> Cc: James Smart <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Jeff Johnson <[email protected]> Cc: Jeff Johnson <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jeroen de Borst <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Joe Lawrence <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jozsef Kadlecsik <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Louis Peens <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Miroslav Benes <[email protected]> Cc: Naveen N Rao <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Nicolas Palix <[email protected]> Cc: Oded Gabbay <[email protected]> Cc: Ofir Bitton <[email protected]> Cc: Pablo Neira Ayuso <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Praveen Kaligineedi <[email protected]> Cc: Ray Jui <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Roger Pau Monné <[email protected]> Cc: Russell King <[email protected]> Cc: Scott Branden <[email protected]> Cc: Shailend Chand <[email protected]> Cc: Simona Vetter <[email protected]> Cc: Simon Horman <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Xiubo Li <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'samples/livepatch/livepatch-shadow-mod.c')
-rw-r--r--samples/livepatch/livepatch-shadow-mod.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c
index 7e753b0d2fa6..5d83ad5a8118 100644
--- a/samples/livepatch/livepatch-shadow-mod.c
+++ b/samples/livepatch/livepatch-shadow-mod.c
@@ -101,8 +101,7 @@ static __used noinline struct dummy *dummy_alloc(void)
if (!d)
return NULL;
- d->jiffies_expire = jiffies +
- msecs_to_jiffies(1000 * EXPIRE_PERIOD);
+ d->jiffies_expire = jiffies + secs_to_jiffies(EXPIRE_PERIOD);
/* Oops, forgot to save leak! */
leak = kzalloc(sizeof(*leak), GFP_KERNEL);
@@ -152,8 +151,7 @@ static void alloc_work_func(struct work_struct *work)
list_add(&d->list, &dummy_list);
mutex_unlock(&dummy_list_mutex);
- schedule_delayed_work(&alloc_dwork,
- msecs_to_jiffies(1000 * ALLOC_PERIOD));
+ schedule_delayed_work(&alloc_dwork, secs_to_jiffies(ALLOC_PERIOD));
}
/*
@@ -184,16 +182,13 @@ static void cleanup_work_func(struct work_struct *work)
}
mutex_unlock(&dummy_list_mutex);
- schedule_delayed_work(&cleanup_dwork,
- msecs_to_jiffies(1000 * CLEANUP_PERIOD));
+ schedule_delayed_work(&cleanup_dwork, secs_to_jiffies(CLEANUP_PERIOD));
}
static int livepatch_shadow_mod_init(void)
{
- schedule_delayed_work(&alloc_dwork,
- msecs_to_jiffies(1000 * ALLOC_PERIOD));
- schedule_delayed_work(&cleanup_dwork,
- msecs_to_jiffies(1000 * CLEANUP_PERIOD));
+ schedule_delayed_work(&alloc_dwork, secs_to_jiffies(ALLOC_PERIOD));
+ schedule_delayed_work(&cleanup_dwork, secs_to_jiffies(CLEANUP_PERIOD));
return 0;
}