[openwrt/openwrt] mac80211: Add devm_platform_get_and_ioremap_resource()

LEDE Commits lede-commits at lists.infradead.org
Sun Oct 24 06:04:36 PDT 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/6a1284cfa87489db1e73b598a2b7aacb00df9f37

commit 6a1284cfa87489db1e73b598a2b7aacb00df9f37
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sun Oct 24 15:03:20 2021 +0200

    mac80211: Add devm_platform_get_and_ioremap_resource()
    
    This function is missing in kernel 5.4, but it is sued by ath10k.
    This fixes the build of ath10k on some targets.
    
    Fixes: cfe0eb7485d8 ("mac80211: Update to version 5.14.13-1")
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ...dd-devm_platform_get_and_ioremap_resource.patch | 79 ++++++++++++++++++++++
 1 file changed, 79 insertions(+)

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 at 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 at 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



More information about the lede-commits mailing list