[PATCH] ARM: l2x0: protect outer_cache_fns.sync pointer assignment with OUTER_CACHE_SYNC
Eran Ben-Avi
eranpublic at yahoo.com
Sun Sep 22 10:52:30 EDT 2013
Outer cache sync pointer function should be assigned only if OUTER_CACHE_SYNC
config option was selected, otherwise pointer is not valid.
Signed-off-by: Eran Ben-Avi <benavi at marvell.com>
---
arch/arm/mm/cache-l2x0.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 447da6f..d358573 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -128,6 +128,7 @@ static inline void l2x0_flush_line(unsigned long addr)
}
#endif
+#ifdef CONFIG_OUTER_CACHE_SYNC
static void l2x0_cache_sync(void)
{
unsigned long flags;
@@ -136,6 +137,7 @@ static void l2x0_cache_sync(void)
cache_sync();
raw_spin_unlock_irqrestore(&l2x0_lock, flags);
}
+#endif
static void __l2x0_flush_all(void)
{
@@ -411,7 +413,9 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
outer_cache.inv_range = l2x0_inv_range;
outer_cache.clean_range = l2x0_clean_range;
outer_cache.flush_range = l2x0_flush_range;
+#ifdef CONFIG_OUTER_CACHE_SYNC
outer_cache.sync = l2x0_cache_sync;
+#endif
outer_cache.flush_all = l2x0_flush_all;
outer_cache.inv_all = l2x0_inv_all;
outer_cache.disable = l2x0_disable;
@@ -861,7 +865,9 @@ static const struct l2x0_of_data pl310_data = {
.inv_range = l2x0_inv_range,
.clean_range = l2x0_clean_range,
.flush_range = l2x0_flush_range,
+#ifdef CONFIG_OUTER_CACHE_SYNC
.sync = l2x0_cache_sync,
+#endif
.flush_all = l2x0_flush_all,
.inv_all = l2x0_inv_all,
.disable = l2x0_disable,
@@ -876,7 +882,9 @@ static const struct l2x0_of_data l2x0_data = {
.inv_range = l2x0_inv_range,
.clean_range = l2x0_clean_range,
.flush_range = l2x0_flush_range,
+#ifdef CONFIG_OUTER_CACHE_SYNC
.sync = l2x0_cache_sync,
+#endif
.flush_all = l2x0_flush_all,
.inv_all = l2x0_inv_all,
.disable = l2x0_disable,
@@ -891,7 +899,9 @@ static const struct l2x0_of_data aurora_with_outer_data = {
.inv_range = aurora_inv_range,
.clean_range = aurora_clean_range,
.flush_range = aurora_flush_range,
+#ifdef CONFIG_OUTER_CACHE_SYNC
.sync = l2x0_cache_sync,
+#endif
.flush_all = l2x0_flush_all,
.inv_all = l2x0_inv_all,
.disable = l2x0_disable,
@@ -914,7 +924,9 @@ static const struct l2x0_of_data bcm_l2x0_data = {
.inv_range = bcm_inv_range,
.clean_range = bcm_clean_range,
.flush_range = bcm_flush_range,
+#ifdef CONFIG_OUTER_CACHE_SYNC
.sync = l2x0_cache_sync,
+#endif
.flush_all = l2x0_flush_all,
.inv_all = l2x0_inv_all,
.disable = l2x0_disable,
--
More information about the linux-arm-kernel
mailing list