diff options
author | Akinobu Mita <mita@miraclelinux.com> | 2006-06-26 11:24:40 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 20:58:17 +0400 |
commit | 1bfba4e8ea0e555e3a0296051517d96253660ccc (patch) | |
tree | 48ced9016b5c08f1be217677c25e6879c07b5278 /drivers/base | |
parent | a7addcea6ac7c0e9733a48cda06ca0880f116a48 (diff) | |
download | linux-1bfba4e8ea0e555e3a0296051517d96253660ccc.tar.xz |
[PATCH] core: use list_move()
This patch converts the combination of list_del(A) and list_add(A, B) to
list_move(A, B).
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/resume.c | 6 | ||||
-rw-r--r-- | drivers/base/power/suspend.c | 13 |
2 files changed, 7 insertions, 12 deletions
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index 520679ce53a8..826093ef4c7e 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c @@ -53,8 +53,7 @@ void dpm_resume(void) struct device * dev = to_device(entry); get_device(dev); - list_del_init(entry); - list_add_tail(entry, &dpm_active); + list_move_tail(entry, &dpm_active); up(&dpm_list_sem); if (!dev->power.prev_state.event) @@ -101,8 +100,7 @@ void dpm_power_up(void) struct device * dev = to_device(entry); get_device(dev); - list_del_init(entry); - list_add_tail(entry, &dpm_active); + list_move_tail(entry, &dpm_active); resume_device(dev); put_device(dev); } diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 1a1fe43a3057..69509e02f703 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c @@ -116,12 +116,10 @@ int device_suspend(pm_message_t state) /* Check if the device got removed */ if (!list_empty(&dev->power.entry)) { /* Move it to the dpm_off or dpm_off_irq list */ - if (!error) { - list_del(&dev->power.entry); - list_add(&dev->power.entry, &dpm_off); - } else if (error == -EAGAIN) { - list_del(&dev->power.entry); - list_add(&dev->power.entry, &dpm_off_irq); + if (!error) + list_move(&dev->power.entry, &dpm_off); + else if (error == -EAGAIN) { + list_move(&dev->power.entry, &dpm_off_irq); error = 0; } } @@ -139,8 +137,7 @@ int device_suspend(pm_message_t state) */ while (!list_empty(&dpm_off_irq)) { struct list_head * entry = dpm_off_irq.next; - list_del(entry); - list_add(entry, &dpm_off); + list_move(entry, &dpm_off); } dpm_resume(); } |