diff options
author | Akinobu Mita <mita@miraclelinux.com> | 2006-06-26 03:24:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:17 -0400 |
commit | 1bfba4e8ea0e555e3a0296051517d96253660ccc (patch) | |
tree | 48ced9016b5c08f1be217677c25e6879c07b5278 /drivers | |
parent | a7addcea6ac7c0e9733a48cda06ca0880f116a48 (diff) |
[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')
-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) | |||
53 | struct device * dev = to_device(entry); | 53 | struct device * dev = to_device(entry); |
54 | 54 | ||
55 | get_device(dev); | 55 | get_device(dev); |
56 | list_del_init(entry); | 56 | list_move_tail(entry, &dpm_active); |
57 | list_add_tail(entry, &dpm_active); | ||
58 | 57 | ||
59 | up(&dpm_list_sem); | 58 | up(&dpm_list_sem); |
60 | if (!dev->power.prev_state.event) | 59 | if (!dev->power.prev_state.event) |
@@ -101,8 +100,7 @@ void dpm_power_up(void) | |||
101 | struct device * dev = to_device(entry); | 100 | struct device * dev = to_device(entry); |
102 | 101 | ||
103 | get_device(dev); | 102 | get_device(dev); |
104 | list_del_init(entry); | 103 | list_move_tail(entry, &dpm_active); |
105 | list_add_tail(entry, &dpm_active); | ||
106 | resume_device(dev); | 104 | resume_device(dev); |
107 | put_device(dev); | 105 | put_device(dev); |
108 | } | 106 | } |
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) | |||
116 | /* Check if the device got removed */ | 116 | /* Check if the device got removed */ |
117 | if (!list_empty(&dev->power.entry)) { | 117 | if (!list_empty(&dev->power.entry)) { |
118 | /* Move it to the dpm_off or dpm_off_irq list */ | 118 | /* Move it to the dpm_off or dpm_off_irq list */ |
119 | if (!error) { | 119 | if (!error) |
120 | list_del(&dev->power.entry); | 120 | list_move(&dev->power.entry, &dpm_off); |
121 | list_add(&dev->power.entry, &dpm_off); | 121 | else if (error == -EAGAIN) { |
122 | } else if (error == -EAGAIN) { | 122 | list_move(&dev->power.entry, &dpm_off_irq); |
123 | list_del(&dev->power.entry); | ||
124 | list_add(&dev->power.entry, &dpm_off_irq); | ||
125 | error = 0; | 123 | error = 0; |
126 | } | 124 | } |
127 | } | 125 | } |
@@ -139,8 +137,7 @@ int device_suspend(pm_message_t state) | |||
139 | */ | 137 | */ |
140 | while (!list_empty(&dpm_off_irq)) { | 138 | while (!list_empty(&dpm_off_irq)) { |
141 | struct list_head * entry = dpm_off_irq.next; | 139 | struct list_head * entry = dpm_off_irq.next; |
142 | list_del(entry); | 140 | list_move(entry, &dpm_off); |
143 | list_add(entry, &dpm_off); | ||
144 | } | 141 | } |
145 | dpm_resume(); | 142 | dpm_resume(); |
146 | } | 143 | } |