[PATCH 04/11] backports: platform_device.h: Add devm_platform_ioremap_resource()
Hauke Mehrtens <[email protected]>
| Newsgroups | org.kernel.vger.backports |
|---|---|
| Message-ID | <[email protected]> |
Add devm_platform_ioremap_resource() from upstream kernel commit
7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") which
is now used by the mt76 driver.
Signed-off-by: Hauke Mehrtens <[email protected]>
---
.../backport-include/linux/platform_device.h | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/backport/backport-include/linux/platform_device.h b/backport/backport-include/linux/platform_device.h
index 5b821ee4..87142d7c 100644
--- a/backport/backport-include/linux/platform_device.h
+++ b/backport/backport-include/linux/platform_device.h
@@ -33,4 +33,26 @@ module_exit(__platform_driver##_exit);
platform_driver_unregister)
#endif
+#if LINUX_VERSION_IS_LESS(5,1,0)
+/**
+ * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
+ * device
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ * resource management
+ * @index: resource index
+ */
+#ifdef CONFIG_HAS_IOMEM
+#define devm_platform_ioremap_resource LINUX_BACKPORT(devm_platform_ioremap_resource)
+static inline void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
+ unsigned int index)
+{
+ struct resource *res;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, index);
+ return devm_ioremap_resource(&pdev->dev, res);
+}
+#endif /* CONFIG_HAS_IOMEM */
+#endif
+
#endif /* __BACKPORT_PLATFORM_DEVICE_H */
--
2.20.1
--
To unsubscribe from this list: send the line "unsubscribe backports" in