summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-02-08 23:38:25 +0100
committerRafael J. Wysocki <rjw@sisk.pl>2011-02-24 19:58:42 +0100
commit13606a2de1996f8d83a9ce296f74022bdbadf712 (patch)
tree02ad0403378ad222dd1ed021ed80fe10fe9a6b39 /drivers/acpi/osl.c
parentACPI: Do not use krefs under a mutex in osl.c (diff)
downloadlinux-13606a2de1996f8d83a9ce296f74022bdbadf712.tar.xz
linux-13606a2de1996f8d83a9ce296f74022bdbadf712.zip
ACPI: Introduce acpi_os_get_iomem()
Introduce function acpi_os_get_iomem() that may be used by its callers to get a reference to an ACPI iomap. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5389f9f2e2ff..52ca8721bc9c 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -285,6 +285,22 @@ acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
return NULL;
}
+void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
+{
+ struct acpi_ioremap *map;
+ void __iomem *virt = NULL;
+
+ mutex_lock(&acpi_ioremap_lock);
+ map = acpi_map_lookup(phys, size);
+ if (map) {
+ virt = map->virt + (phys - map->phys);
+ map->refcount++;
+ }
+ mutex_unlock(&acpi_ioremap_lock);
+ return virt;
+}
+EXPORT_SYMBOL_GPL(acpi_os_get_iomem);
+
/* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
static struct acpi_ioremap *
acpi_map_lookup_virt(void __iomem *virt, acpi_size size)