[PATCH 14/19] include: linux/device.h: implement dev_platform_ioremap_resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are more than a thousand instances of devm_platform_ioremap_resource
across Linux drivers and porting it to barebox is cumbersome, because
unlike Linux we don't remap, so the MMIO region may be at address zero.

Now that dev_request_mem_region_err_null() prints a warning in that
case, let's just use it to implement dev_platform_ioremap_resource().

Platforms with relevant MMIO at address 0 are scarce anyway and when we
run on such a platform, we can always switch to use normal
dev_request_mem_resource().

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/linux/device.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index 0bd61154ac30..d892a9cb0ef5 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -32,6 +32,18 @@
 #define driver_register register_driver
 #define driver_unregister unregister_driver
 
+
+static inline void __iomem *dev_platform_ioremap_resource(struct device *dev,
+							  int resource)
+{
+	/*
+	 * barebox maps everything outside the RAM banks suitably for MMIO,
+	 * so we don't need to do anything besides requesting the regions
+	 * and can leave the memory attributes unchanged.
+	 */
+	return dev_request_mem_region_err_null(dev, resource);
+}
+
 static inline void __iomem *devm_ioremap(struct device *dev,
 					 resource_size_t start,
 					 resource_size_t size)
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux