Commit 4e82d2e2 authored by Baokun Li's avatar Baokun Li Committed by Thomas Gleixner

clockevents: Use list_move() instead of list_del()/list_add()

Simplify the code.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210609070242.1322450-1-libaokun1@huawei.com
parent 22a22383
...@@ -347,8 +347,7 @@ static void clockevents_notify_released(void) ...@@ -347,8 +347,7 @@ static void clockevents_notify_released(void)
while (!list_empty(&clockevents_released)) { while (!list_empty(&clockevents_released)) {
dev = list_entry(clockevents_released.next, dev = list_entry(clockevents_released.next,
struct clock_event_device, list); struct clock_event_device, list);
list_del(&dev->list); list_move(&dev->list, &clockevent_devices);
list_add(&dev->list, &clockevent_devices);
tick_check_new_device(dev); tick_check_new_device(dev);
} }
} }
...@@ -576,8 +575,7 @@ void clockevents_exchange_device(struct clock_event_device *old, ...@@ -576,8 +575,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
if (old) { if (old) {
module_put(old->owner); module_put(old->owner);
clockevents_switch_state(old, CLOCK_EVT_STATE_DETACHED); clockevents_switch_state(old, CLOCK_EVT_STATE_DETACHED);
list_del(&old->list); list_move(&old->list, &clockevents_released);
list_add(&old->list, &clockevents_released);
} }
if (new) { if (new) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment