diff mbox

[1/7] ARM: l2x0: add empty l2x0_of_init

Message ID 1314841446-11006-2-git-send-email-robherring2@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rob Herring Sept. 1, 2011, 1:44 a.m. UTC
From: Rob Herring <rob.herring@calxeda.com>

Add empty version of l2x0_of_init for when CONFIG_CACHE_L2X0 is not selected.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/include/asm/hardware/cache-l2x0.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

Barry Song Sept. 1, 2011, 3:36 a.m. UTC | #1
2011/9/1 Rob Herring <robherring2@gmail.com>:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Add empty version of l2x0_of_init for when CONFIG_CACHE_L2X0 is not selected.
>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Acked-by: Barry Song <21cnbao@gmail.com>

it seems most people use
"
#ifdef CONFIG_CACHE_L2X0
...
l2x0 related codes
...
#endif
"
or
"
obj-$(CONFIG_CACHE_L2X0) += xxx-l2x0.o
"

to avoid l2x0 related codes compiled and linked into kernel.

but this patch provides another option. it is not bad too.

> ---
>  arch/arm/include/asm/hardware/cache-l2x0.h |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
> index 4a6004a..967a808 100644
> --- a/arch/arm/include/asm/hardware/cache-l2x0.h
> +++ b/arch/arm/include/asm/hardware/cache-l2x0.h
> @@ -90,7 +90,14 @@
>
>  #ifndef __ASSEMBLY__
>  extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
> +#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
>  extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask);
> +#else
> +static int l2x0_of_init(__u32 aux_val, __u32 aux_mask)
> +{
> +       return -ENODEV;
> +}
>  #endif
> +#endif /* __ASSEMBLY__ */
>
>  #endif
> --
> 1.7.4.1

-barry
Rob Herring Sept. 1, 2011, 3:58 a.m. UTC | #2
Barry,

On 08/31/2011 10:36 PM, Barry Song wrote:
> 2011/9/1 Rob Herring <robherring2@gmail.com>:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Add empty version of l2x0_of_init for when CONFIG_CACHE_L2X0 is not selected.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> 
> Acked-by: Barry Song <21cnbao@gmail.com>
> 
Thanks.

> it seems most people use
> "
> #ifdef CONFIG_CACHE_L2X0
> ...
> l2x0 related codes
> ...
> #endif
> "
> or
> "
> obj-$(CONFIG_CACHE_L2X0) += xxx-l2x0.o
> "
> 
> to avoid l2x0 related codes compiled and linked into kernel.
> 
> but this patch provides another option. it is not bad too.
> 

The difference with existing platforms and l2x0_init is the ioremap or
static mapping and latency register setup for pl310 is outside the
function, so you still need an ifdef around all that. With l2x0_of_init,
all the setup is done inside the function, so having an empty version is
useful.

Rob
diff mbox

Patch

diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 4a6004a..967a808 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -90,7 +90,14 @@ 
 
 #ifndef __ASSEMBLY__
 extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
+#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
 extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask);
+#else
+static int l2x0_of_init(__u32 aux_val, __u32 aux_mask)
+{
+	return -ENODEV;
+}
 #endif
+#endif /* __ASSEMBLY__ */
 
 #endif