Skip to contentSkip to conversation

arc: kernel: use exporting symbol instead of static inline for arc_get_core_freq()

PATCH Superseded Chen Gang 1 participant 3 messages Oct 28, 2013 Synopsys ARC architecture

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 arc: kernel: use exporting symbol instead of static inline for arc_get_core_freq()

Need export arc_get_core_freq() instead of let it static inline, or if other individual modules use it (e.g. use BASE_BAUD), it can not find core_freq variable.

---
 arch/arc/include/asm/clk.h |    9 +--------
 arch/arc/kernel/clk.c      |    9 ++++++++-
 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arc/include/asm/clk.h +1 -8
index bf9d29f..256321a 100644
@@ -9,14 +9,7 @@
 #ifndef _ASM_ARC_CLK_H
 #define _ASM_ARC_CLK_H
 
-/* Although we can't really hide core_freq, the accessor is still better way */
-extern unsigned long core_freq;
-
-static inline unsigned long arc_get_core_freq(void)
-{
-	return core_freq;
-}
-
+extern unsigned long arc_get_core_freq(void);
 extern int arc_set_core_freq(unsigned long);
 
 #endif
arch/arc/kernel/clk.c +8 -1
index 10c7b0b..9f4602f 100644
@@ -6,9 +6,16 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/module.h>
 #include <asm/clk.h>
 
-unsigned long core_freq = 80000000;
+static unsigned long core_freq = 80000000;
+
+unsigned long arc_get_core_freq(void)
+{
+	return core_freq;
+}
+EXPORT_SYMBOL_GPL(arc_get_core_freq);
 
 /*
  * As of now we default to device-tree provided clock
Signature · 1 line
1.7.7.6
author
#1 lore raw
Quoted 40 lines · Chen Gang

Need export arc_get_core_freq() instead of let it static inline, or if other individual modules use it (e.g. use BASE_BAUD), it can not find core_freq variable.

---
 arch/arc/include/asm/clk.h |    9 +--------
 arch/arc/kernel/clk.c      |    9 ++++++++-
 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arc/include/asm/clk.h +1 -8
index bf9d29f..256321a 100644
@@ -9,14 +9,7 @@
 #ifndef _ASM_ARC_CLK_H
 #define _ASM_ARC_CLK_H
 
-/* Although we can't really hide core_freq, the accessor is still better way */
-extern unsigned long core_freq;
-
-static inline unsigned long arc_get_core_freq(void)
-{
-	return core_freq;
-}
-
+extern unsigned long arc_get_core_freq(void);
 extern int arc_set_core_freq(unsigned long);
 
 #endif
arch/arc/kernel/clk.c +1 -0
index 10c7b0b..9f4602f 100644
@@ -6,9 +6,16 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/module.h>
 #include <asm/clk.h>

arch/arc/kernel/clk.c line 19

Quoted 10 lines
arch/arc/kernel/clk.c +7 -1
 
-unsigned long core_freq = 80000000;
+static unsigned long core_freq = 80000000;
+
+unsigned long arc_get_core_freq(void)
+{
+	return core_freq;
+}
+EXPORT_SYMBOL_GPL(arc_get_core_freq);
 

Oh, sorry, need use EXPORT_SYMBOL instead of EXPORT_SYMBOL_GPL for it. I will send patch v2.

Quoted 3 lines
arch/arc/kernel/clk.c +0 -0
 /*
  * As of now we default to device-tree provided clock
Signature · 1 line
Chen Gang
author
#2 lore raw

PATCH v2 1/1 arc: kernel: use exporting symbol instead of static inline for arc_get_core_freq()

Need export arc_get_core_freq() instead of let it static inline, or if other individual modules use it (e.g. use BASE_BAUD), it can not find core_freq variable.

---
 arch/arc/include/asm/clk.h |    9 +--------
 arch/arc/kernel/clk.c      |    9 ++++++++-
 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arc/include/asm/clk.h +1 -8
index bf9d29f..256321a 100644
@@ -9,14 +9,7 @@
 #ifndef _ASM_ARC_CLK_H
 #define _ASM_ARC_CLK_H
 
-/* Although we can't really hide core_freq, the accessor is still better way */
-extern unsigned long core_freq;
-
-static inline unsigned long arc_get_core_freq(void)
-{
-	return core_freq;
-}
-
+extern unsigned long arc_get_core_freq(void);
 extern int arc_set_core_freq(unsigned long);
 
 #endif
arch/arc/kernel/clk.c +8 -1
index 10c7b0b..798be4a 100644
@@ -6,9 +6,16 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/module.h>
 #include <asm/clk.h>
 
-unsigned long core_freq = 80000000;
+static unsigned long core_freq = 80000000;
+
+unsigned long arc_get_core_freq(void)
+{
+	return core_freq;
+}
+EXPORT_SYMBOL(arc_get_core_freq);
 
 /*
  * As of now we default to device-tree provided clock
Signature · 1 line
1.7.7.6