diff options
author | Christoph Hellwig <hch@lst.de> | 2015-08-17 17:00:35 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-08-28 02:40:58 +0300 |
commit | 41e94a851304f7acac840adec4004f8aeee53ad4 (patch) | |
tree | fe4c599d1263b7fdd92eb2838e5d223015066718 /include/linux/io.h | |
parent | 033fbae988fcb67e5077203512181890848b8e90 (diff) | |
download | linux-41e94a851304f7acac840adec4004f8aeee53ad4.tar.xz |
add devm_memremap_pages
This behaves like devm_memremap except that it ensures we have page
structures available that can back the region.
Signed-off-by: Christoph Hellwig <hch@lst.de>
[djbw: catch attempts to remap RAM, drop flags]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/io.h')
-rw-r--r-- | include/linux/io.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/io.h b/include/linux/io.h index d8d749abd665..de64c1e53612 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -20,10 +20,13 @@ #include <linux/types.h> #include <linux/init.h> +#include <linux/bug.h> +#include <linux/err.h> #include <asm/io.h> #include <asm/page.h> struct device; +struct resource; __visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count); void __iowrite64_copy(void __iomem *to, const void *from, size_t count); @@ -84,6 +87,23 @@ void *devm_memremap(struct device *dev, resource_size_t offset, size_t size, unsigned long flags); void devm_memunmap(struct device *dev, void *addr); +void *__devm_memremap_pages(struct device *dev, struct resource *res); + +#ifdef CONFIG_ZONE_DEVICE +void *devm_memremap_pages(struct device *dev, struct resource *res); +#else +static inline void *devm_memremap_pages(struct device *dev, struct resource *res) +{ + /* + * Fail attempts to call devm_memremap_pages() without + * ZONE_DEVICE support enabled, this requires callers to fall + * back to plain devm_memremap() based on config + */ + WARN_ON_ONCE(1); + return ERR_PTR(-ENXIO); +} +#endif + /* * Some systems do not have legacy ISA devices. * /dev/port is not a valid interface on these systems. |