Skip to content

Commit

Permalink
clockevents: Use list_move() instead of list_del()/list_add()
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
LiBaokun96 authored and KAGA-KOKO committed Jun 22, 2021
1 parent 22a2238 commit 4e82d2e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kernel/time/clockevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ static void clockevents_notify_released(void)
while (!list_empty(&clockevents_released)) {
dev = list_entry(clockevents_released.next,
struct clock_event_device, list);
list_del(&dev->list);
list_add(&dev->list, &clockevent_devices);
list_move(&dev->list, &clockevent_devices);
tick_check_new_device(dev);
}
}
Expand Down Expand Up @@ -576,8 +575,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
if (old) {
module_put(old->owner);
clockevents_switch_state(old, CLOCK_EVT_STATE_DETACHED);
list_del(&old->list);
list_add(&old->list, &clockevents_released);
list_move(&old->list, &clockevents_released);
}

if (new) {
Expand Down

0 comments on commit 4e82d2e

Please sign in to comment.