lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210902092704.2678277-1-zhang.lyra@gmail.com>
Date:   Thu,  2 Sep 2021 17:27:03 +0800
From:   Chunyan Zhang <zhang.lyra@...il.com>
To:     Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>
Cc:     devicetree@...r.kernel.org, Chunyan Zhang <zhang.lyra@...il.com>,
        Chunyan Zhang <chunyan.zhang@...soc.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] of: fix of_address_to_resource and of_iomap undefined

From: Chunyan Zhang <chunyan.zhang@...soc.com>

If CONFIG_OF is selected, but CONFIG_OF_ADDRESS is not, when compiling
files (sunch as timer_of.c) in which the function of_iomap() is invoked,
compiler would report 'undefined reference to of_iomap', the same case
is for of_address_to_resource().

This patch also makes sure that of_iomap() and of_address_to_resource()
are declared for sparc so that sparc can have its specific
implementations in arch/sparc/kernel/of_device_common.c, even if
including include/linux/of_address.h in it.

Signed-off-by: Chunyan Zhang <chunyan.zhang@...soc.com>
---
 include/linux/of_address.h | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 45598dbec269..02a719d58466 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -80,6 +80,23 @@ static inline u64 of_translate_address(struct device_node *np,
 	return OF_BAD_ADDR;
 }
 
+#ifdef CONFIG_SPARC
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+void __iomem *of_iomap(struct device_node *device, int index);
+#else
+static inline int of_address_to_resource(struct device_node *dev, int index,
+					 struct resource *r)
+{
+	return -EINVAL;
+}
+
+static inline void __iomem *of_iomap(struct device_node *device, int index)
+{
+	return NULL;
+}
+#endif
+
 static inline const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no,
 					     u64 *size, unsigned int *flags)
 {
@@ -124,22 +141,6 @@ static inline bool of_dma_is_coherent(struct device_node *np)
 }
 #endif /* CONFIG_OF_ADDRESS */
 
-#ifdef CONFIG_OF
-extern int of_address_to_resource(struct device_node *dev, int index,
-				  struct resource *r);
-void __iomem *of_iomap(struct device_node *node, int index);
-#else
-static inline int of_address_to_resource(struct device_node *dev, int index,
-					 struct resource *r)
-{
-	return -EINVAL;
-}
-
-static inline void __iomem *of_iomap(struct device_node *device, int index)
-{
-	return NULL;
-}
-#endif
 #define of_range_parser_init of_pci_range_parser_init
 
 static inline const __be32 *of_get_address(struct device_node *dev, int index,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ