Skip to contentSkip to conversation

ARM: imx: build cpu_is_imx6sl function conditionally

PATCH New Arnd Bergmann 3 participants 4 messages Jul 3, 2014 – Jul 4, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx: build cpu_is_imx6sl function conditionally

imx6q_pm_enter calls imx6sl_set_wait_clk when run on an imx6sl based machine. However if support for imx6sl is not enabled at compile time, this prevents us from building the kernel and we get this link error instead:

arch/arm/mach-imx/built-in.o: In function `imx6q_pm_enter':
:(.text+0x4b84): undefined reference to `imx6sl_set_wait_clk'

This makes the cpu_is_imx6sl function conditionally return false if imx6sl is disabled at compile-time, which matches what the older cpu_is_mx* macros did. We have similar inline functions for the other imx6 variants, but so far I have not run into a case where the extra #ifdef is necessary.

arch/arm/mach-imx/mxc.h +4 -0
index 75d6a37..b03b808 100644
@@ -156,7 +156,11 @@ extern unsigned int __mxc_cpu_type;
 #ifndef __ASSEMBLY__
 static inline bool cpu_is_imx6sl(void)
 {
+#ifdef CONFIG_SOC_IMX6SL
 	return __mxc_cpu_type == MXC_CPU_IMX6SL;
+#else
+	return 0;
+#endif
 }
 
 static inline bool cpu_is_imx6dl(void)
Applied
#1 lore raw

PATCH 1/1 ARM: imx: build cpu_is_imx6sl function conditionally

Quoted 8 lines · Arnd Bergmann

imx6q_pm_enter calls imx6sl_set_wait_clk when run on an imx6sl based machine. However if support for imx6sl is not enabled at compile time, this prevents us from building the kernel and we get this link error instead:

arch/arm/mach-imx/built-in.o: In function `imx6q_pm_enter':
:(.text+0x4b84): undefined reference to `imx6sl_set_wait_clk'

Quoted 7 lines

This makes the cpu_is_imx6sl function conditionally return false if imx6sl is disabled at compile-time, which matches what the older cpu_is_mx* macros did. We have similar inline functions for the other imx6 variants, but so far I have not run into a case where the extra #ifdef is necessary.

Applied, thanks.

#2 lore raw

PATCH 1/1 ARM: imx: build cpu_is_imx6sl function conditionally

In reply to Arnd Bergmann

Hello.

Quoted 21 lines · Arnd Bergmann

imx6q_pm_enter calls imx6sl_set_wait_clk when run on an imx6sl based machine. However if support for imx6sl is not enabled at compile time, this prevents us from building the kernel and we get this link error instead:

arch/arm/mach-imx/built-in.o: In function `imx6q_pm_enter':
:(.text+0x4b84): undefined reference to `imx6sl_set_wait_clk'

This makes the cpu_is_imx6sl function conditionally return false if imx6sl is disabled at compile-time, which matches what the older cpu_is_mx* macros did. We have similar inline functions for the other imx6 variants, but so far I have not run into a case where the extra #ifdef is necessary.

arch/arm/mach-imx/mxc.h +0 -0
index 75d6a37..b03b808 100644

arch/arm/mach-imx/mxc.h extern unsigned int __mxc_cpu_type; · line 162

Quoted 7 lines
arch/arm/mach-imx/mxc.h +3 -0
@@ -156,7 +156,11 @@ extern unsigned int __mxc_cpu_type;
  #ifndef __ASSEMBLY__
  static inline bool cpu_is_imx6sl(void)
  {
+#ifdef CONFIG_SOC_IMX6SL
  	return __mxc_cpu_type == MXC_CPU_IMX6SL;
+#else
+	return 0;
    s/0/false/.

arch/arm/mach-imx/mxc.h extern unsigned int __mxc_cpu_type; · line 163

Quoted 1 line
arch/arm/mach-imx/mxc.h +1 -0
+#endif

Also, #ifdef's in a function body are ugly.

arch/arm/mach-imx/mxc.h extern unsigned int __mxc_cpu_type; · line 164

Quoted 1 line
arch/arm/mach-imx/mxc.h +0 -0
  }

WBR, Sergei

#3 lore raw

PATCH 1/1 ARM: imx: build cpu_is_imx6sl function conditionally

Quoted 11 lines · Sergei Shtylyov

arch/arm/mach-imx/mxc.h extern unsigned int __mxc_cpu_type; · line 162

Quoted 8 lines
arch/arm/mach-imx/mxc.h +3 -0
@@ -156,7 +156,11 @@ extern unsigned int __mxc_cpu_type;
 #ifndef __ASSEMBLY__
 static inline bool cpu_is_imx6sl(void)
 {
+#ifdef CONFIG_SOC_IMX6SL
 	return __mxc_cpu_type == MXC_CPU_IMX6SL;
+#else
+	return 0;
   s/0/false/.
Quoted 3 lines

arch/arm/mach-imx/mxc.h extern unsigned int __mxc_cpu_type; · line 163

Quoted 1 line
arch/arm/mach-imx/mxc.h +1 -0
+#endif

Also, #ifdef's in a function body are ugly.

Okay, I fixed it up as below.

#ifdef CONFIG_SOC_IMX6SL
static inline bool cpu_is_imx6sl(void)

{
        return __mxc_cpu_type == MXC_CPU_IMX6SL;
}
#else
static inline bool cpu_is_imx6sl(void)
{
        return false;
}

#endif

Shawn