Skip to content

Commit 4e82d2e

Browse files
LiBaokun96KAGA-KOKO
authored andcommitted
clockevents: Use list_move() instead of list_del()/list_add()
Simplify the code. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Baokun Li <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 22a2238 commit 4e82d2e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kernel/time/clockevents.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ static void clockevents_notify_released(void)
347347
while (!list_empty(&clockevents_released)) {
348348
dev = list_entry(clockevents_released.next,
349349
struct clock_event_device, list);
350-
list_del(&dev->list);
351-
list_add(&dev->list, &clockevent_devices);
350+
list_move(&dev->list, &clockevent_devices);
352351
tick_check_new_device(dev);
353352
}
354353
}
@@ -576,8 +575,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
576575
if (old) {
577576
module_put(old->owner);
578577
clockevents_switch_state(old, CLOCK_EVT_STATE_DETACHED);
579-
list_del(&old->list);
580-
list_add(&old->list, &clockevents_released);
578+
list_move(&old->list, &clockevents_released);
581579
}
582580

583581
if (new) {

0 commit comments

Comments
 (0)