Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 241673
b: refs/heads/master
c: bb45e39
h: refs/heads/master
i:
  241671: 143899c
v: v3
  • Loading branch information
Rafael J. Wysocki committed Feb 24, 2011
1 parent f710f65 commit 0918a7c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13606a2de1996f8d83a9ce296f74022bdbadf712
refs/heads/master: bb45e394e21eb2abc710ad43d98ebac1069bf355
22 changes: 19 additions & 3 deletions trunk/drivers/acpi/nvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct nvs_page {
unsigned int size;
void *kaddr;
void *data;
bool unmap;
struct list_head node;
};

Expand All @@ -44,6 +45,9 @@ int suspend_nvs_register(unsigned long start, unsigned long size)
{
struct nvs_page *entry, *next;

pr_info("PM: Registering ACPI NVS region at %lx (%ld bytes)\n",
start, size);

while (size > 0) {
unsigned int nr_bytes;

Expand Down Expand Up @@ -81,7 +85,13 @@ void suspend_nvs_free(void)
free_page((unsigned long)entry->data);
entry->data = NULL;
if (entry->kaddr) {
iounmap(entry->kaddr);
if (entry->unmap) {
iounmap(entry->kaddr);
entry->unmap = false;
} else {
acpi_os_unmap_memory(entry->kaddr,
entry->size);
}
entry->kaddr = NULL;
}
}
Expand Down Expand Up @@ -115,8 +125,14 @@ int suspend_nvs_save(void)

list_for_each_entry(entry, &nvs_list, node)
if (entry->data) {
entry->kaddr = acpi_os_ioremap(entry->phys_start,
entry->size);
unsigned long phys = entry->phys_start;
unsigned int size = entry->size;

entry->kaddr = acpi_os_get_iomem(phys, size);
if (!entry->kaddr) {
entry->kaddr = acpi_os_ioremap(phys, size);
entry->unmap = !!entry->kaddr;
}
if (!entry->kaddr) {
suspend_nvs_free();
return -ENOMEM;
Expand Down

0 comments on commit 0918a7c

Please sign in to comment.