diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/pm.c | 37 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 10 | ||||
-rw-r--r-- | kernel/power/swap.c | 26 |
3 files changed, 22 insertions, 51 deletions
diff --git a/kernel/power/pm.c b/kernel/power/pm.c index 84063ac8fcfc..c50d15266c10 100644 --- a/kernel/power/pm.c +++ b/kernel/power/pm.c | |||
@@ -75,42 +75,6 @@ struct pm_dev *pm_register(pm_dev_t type, | |||
75 | return dev; | 75 | return dev; |
76 | } | 76 | } |
77 | 77 | ||
78 | static void __pm_unregister(struct pm_dev *dev) | ||
79 | { | ||
80 | if (dev) { | ||
81 | list_del(&dev->entry); | ||
82 | kfree(dev); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * pm_unregister_all - unregister all devices with matching callback | ||
88 | * @callback: callback function pointer | ||
89 | * | ||
90 | * Unregister every device that would call the callback passed. This | ||
91 | * is primarily meant as a helper function for loadable modules. It | ||
92 | * enables a module to give up all its managed devices without keeping | ||
93 | * its own private list. | ||
94 | */ | ||
95 | |||
96 | void pm_unregister_all(pm_callback callback) | ||
97 | { | ||
98 | struct list_head *entry; | ||
99 | |||
100 | if (!callback) | ||
101 | return; | ||
102 | |||
103 | mutex_lock(&pm_devs_lock); | ||
104 | entry = pm_devs.next; | ||
105 | while (entry != &pm_devs) { | ||
106 | struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); | ||
107 | entry = entry->next; | ||
108 | if (dev->callback == callback) | ||
109 | __pm_unregister(dev); | ||
110 | } | ||
111 | mutex_unlock(&pm_devs_lock); | ||
112 | } | ||
113 | |||
114 | /** | 78 | /** |
115 | * pm_send - send request to a single device | 79 | * pm_send - send request to a single device |
116 | * @dev: device to send to | 80 | * @dev: device to send to |
@@ -239,7 +203,6 @@ int pm_send_all(pm_request_t rqst, void *data) | |||
239 | } | 203 | } |
240 | 204 | ||
241 | EXPORT_SYMBOL(pm_register); | 205 | EXPORT_SYMBOL(pm_register); |
242 | EXPORT_SYMBOL(pm_unregister_all); | ||
243 | EXPORT_SYMBOL(pm_send_all); | 206 | EXPORT_SYMBOL(pm_send_all); |
244 | EXPORT_SYMBOL(pm_active); | 207 | EXPORT_SYMBOL(pm_active); |
245 | 208 | ||
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 24c96f354231..75d4886e648e 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -227,11 +227,17 @@ static void copy_data_pages(struct pbe *pblist) | |||
227 | for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) { | 227 | for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) { |
228 | if (saveable(zone, &zone_pfn)) { | 228 | if (saveable(zone, &zone_pfn)) { |
229 | struct page *page; | 229 | struct page *page; |
230 | long *src, *dst; | ||
231 | int n; | ||
232 | |||
230 | page = pfn_to_page(zone_pfn + zone->zone_start_pfn); | 233 | page = pfn_to_page(zone_pfn + zone->zone_start_pfn); |
231 | BUG_ON(!pbe); | 234 | BUG_ON(!pbe); |
232 | pbe->orig_address = (unsigned long)page_address(page); | 235 | pbe->orig_address = (unsigned long)page_address(page); |
233 | /* copy_page is not usable for copying task structs. */ | 236 | /* copy_page and memcpy are not usable for copying task structs. */ |
234 | memcpy((void *)pbe->address, (void *)pbe->orig_address, PAGE_SIZE); | 237 | dst = (long *)pbe->address; |
238 | src = (long *)pbe->orig_address; | ||
239 | for (n = PAGE_SIZE / sizeof(long); n; n--) | ||
240 | *dst++ = *src++; | ||
235 | pbe = pbe->next; | 241 | pbe = pbe->next; |
236 | } | 242 | } |
237 | } | 243 | } |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 044b8e0c1025..f1dd146bd64d 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -263,7 +263,6 @@ int swsusp_write(void) | |||
263 | struct swap_map_handle handle; | 263 | struct swap_map_handle handle; |
264 | struct snapshot_handle snapshot; | 264 | struct snapshot_handle snapshot; |
265 | struct swsusp_info *header; | 265 | struct swsusp_info *header; |
266 | unsigned long start; | ||
267 | int error; | 266 | int error; |
268 | 267 | ||
269 | if ((error = swsusp_swap_check())) { | 268 | if ((error = swsusp_swap_check())) { |
@@ -281,16 +280,17 @@ int swsusp_write(void) | |||
281 | } | 280 | } |
282 | error = get_swap_writer(&handle); | 281 | error = get_swap_writer(&handle); |
283 | if (!error) { | 282 | if (!error) { |
284 | start = handle.cur_swap; | 283 | unsigned long start = handle.cur_swap; |
285 | error = swap_write_page(&handle, header); | 284 | error = swap_write_page(&handle, header); |
286 | } | 285 | if (!error) |
287 | if (!error) | 286 | error = save_image(&handle, &snapshot, |
288 | error = save_image(&handle, &snapshot, header->pages - 1); | 287 | header->pages - 1); |
289 | if (!error) { | 288 | if (!error) { |
290 | flush_swap_writer(&handle); | 289 | flush_swap_writer(&handle); |
291 | printk("S"); | 290 | printk("S"); |
292 | error = mark_swapfiles(swp_entry(root_swap, start)); | 291 | error = mark_swapfiles(swp_entry(root_swap, start)); |
293 | printk("|\n"); | 292 | printk("|\n"); |
293 | } | ||
294 | } | 294 | } |
295 | if (error) | 295 | if (error) |
296 | free_all_swap_pages(root_swap, handle.bitmap); | 296 | free_all_swap_pages(root_swap, handle.bitmap); |
@@ -311,8 +311,10 @@ static atomic_t io_done = ATOMIC_INIT(0); | |||
311 | 311 | ||
312 | static int end_io(struct bio *bio, unsigned int num, int err) | 312 | static int end_io(struct bio *bio, unsigned int num, int err) |
313 | { | 313 | { |
314 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | 314 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { |
315 | panic("I/O error reading memory image"); | 315 | printk(KERN_ERR "I/O error reading swsusp image.\n"); |
316 | return -EIO; | ||
317 | } | ||
316 | atomic_set(&io_done, 0); | 318 | atomic_set(&io_done, 0); |
317 | return 0; | 319 | return 0; |
318 | } | 320 | } |