aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch b/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch
new file mode 100644
index 0000000000..a06c619471
--- /dev/null
+++ b/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch
@@ -0,0 +1,79 @@
+From d49395058c6bd4fb7b8bcc5ff7b4d7fbd9b6f97b Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 24 Oct 2021 14:49:55 +0200
+Subject: [PATCH] headers: Add devm_platform_get_and_ioremap_resource()
+
+This function is copied from kernel 5.7 and used by mt76, ath10k and
+ath11k. devm_platform_ioremap_resource() was changed to make sue of
+this new function.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ .../backport-include/linux/platform_device.h | 45 ++++++++++++++++---
+ 1 file changed, 38 insertions(+), 7 deletions(-)
+
+--- a/backport-include/linux/platform_device.h
++++ b/backport-include/linux/platform_device.h
+@@ -33,7 +33,39 @@ module_exit(__platform_driver##_exit);
+ platform_driver_unregister)
+ #endif
+
++#if LINUX_VERSION_IS_LESS(5,7,0)
++#ifdef CONFIG_HAS_IOMEM
++#define devm_platform_get_and_ioremap_resource LINUX_BACKPORT(devm_platform_get_and_ioremap_resource)
++/**
++ * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a
++ * platform device and get resource
++ *
++ * @pdev: platform device to use both for memory resource lookup as well as
++ * resource management
++ * @index: resource index
++ * @res: optional output parameter to store a pointer to the obtained resource.
++ *
++ * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
++ * on failure.
++ */
++static inline void __iomem *
++devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
++ unsigned int index, struct resource **res)
++{
++ struct resource *r;
++
++ r = platform_get_resource(pdev, IORESOURCE_MEM, index);
++ if (res)
++ *res = r;
++ return devm_ioremap_resource(&pdev->dev, r);
++}
++#endif /* CONFIG_HAS_IOMEM */
++#endif /* < 5.7 */
++
+ #if LINUX_VERSION_IS_LESS(5,1,0)
++
++#ifdef CONFIG_HAS_IOMEM
++#define devm_platform_ioremap_resource LINUX_BACKPORT(devm_platform_ioremap_resource)
+ /**
+ * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
+ * device
+@@ -41,16 +73,15 @@ module_exit(__platform_driver##_exit);
+ * @pdev: platform device to use both for memory resource lookup as well as
+ * resource management
+ * @index: resource index
++ *
++ * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
++ * on failure.
+ */
+-#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,
++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);
++ return devm_platform_get_and_ioremap_resource(pdev, index, NULL);
+ }
+ #endif /* CONFIG_HAS_IOMEM */
+ #endif