Skip to content

Commit

Permalink
Merge branch 'iomem' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
lenb committed Feb 15, 2011
2 parents ed764e7 + 884b821 commit dc33974
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,17 +636,21 @@ EXPORT_SYMBOL(acpi_os_write_port);
acpi_status
acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
{
u32 dummy;
void __iomem *virt_addr;
int size = width / 8, unmap = 0;
unsigned int size = width / 8;
bool unmap = false;
u32 dummy;

rcu_read_lock();
virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
rcu_read_unlock();
if (!virt_addr) {
rcu_read_unlock();
virt_addr = acpi_os_ioremap(phys_addr, size);
unmap = 1;
if (!virt_addr)
return AE_BAD_ADDRESS;
unmap = true;
}

if (!value)
value = &dummy;

Expand All @@ -666,6 +670,8 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)

if (unmap)
iounmap(virt_addr);
else
rcu_read_unlock();

return AE_OK;
}
Expand All @@ -674,14 +680,17 @@ acpi_status
acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
{
void __iomem *virt_addr;
int size = width / 8, unmap = 0;
unsigned int size = width / 8;
bool unmap = false;

rcu_read_lock();
virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
rcu_read_unlock();
if (!virt_addr) {
rcu_read_unlock();
virt_addr = acpi_os_ioremap(phys_addr, size);
unmap = 1;
if (!virt_addr)
return AE_BAD_ADDRESS;
unmap = true;
}

switch (width) {
Expand All @@ -700,6 +709,8 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)

if (unmap)
iounmap(virt_addr);
else
rcu_read_unlock();

return AE_OK;
}
Expand Down

0 comments on commit dc33974

Please sign in to comment.