Re: [patch 11/23] Fix m32r __xchg

Previous thread: [patch 10/23] New cmpxchg_local (optimized for UP case) for m32r by Mathieu Desnoyers on Sunday, August 12, 2007 - 10:54 am. (1 message)

Next thread: [patch 12/23] local_t m32r use architecture specific cmpxchg_local by Mathieu Desnoyers on Sunday, August 12, 2007 - 10:54 am. (1 message)
To: <akpm@...>, <linux-kernel@...>
Cc: Christoph Lameter <clameter@...>, Mathieu Desnoyers <mathieu.desnoyers@...>, <takata@...>, <linux-m32r@...>
Date: Sunday, August 12, 2007 - 10:54 am

the #endif /* CONFIG_SMP */ should cover the default condition, or it may cause
bad parameter to be silently missed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: takata@linux-m32r.org
CC: linux-m32r@ml.linux-m32r.org
---
include/asm-m32r/system.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-lttng/include/asm-m32r/system.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-m32r/system.h 2007-08-07 14:55:02.000000000 -0400
+++ linux-2.6-lttng/include/asm-m32r/system.h 2007-08-07 14:57:57.000000000 -0400
@@ -189,9 +189,9 @@ __xchg(unsigned long x, volatile void *
#endif /* CONFIG_CHIP_M32700_TS1 */
);
break;
+#endif /* CONFIG_SMP */
default:
__xchg_called_with_bad_pointer();
-#endif /* CONFIG_SMP */
}

local_irq_restore(flags);

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-

To: Mathieu Desnoyers <mathieu.desnoyers@...>
Cc: <akpm@...>, <linux-kernel@...>, Christoph Lameter <clameter@...>, <takata@...>, <linux-m32r@...>
Date: Saturday, August 18, 2007 - 4:40 pm

It seems you never checked whether your patch compiles:

<-- snip -->

...
CC init/main.o
In file included from include2/asm/bitops.h:16,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/include/linux/bitops.h:9,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/include/linux/kernel.h:15,
from include2/asm/processor.h:16,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/include/linux/prefetch.h:14,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/include/linux/list.h:8,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/include/linux/module.h:9,
from /home/bunk/linux/kernel-2.6/linux-2.6.23-rc2-mm2/init/main.c:13:
include2/asm/system.h: In function '__xchg':
include2/asm/system.h:191: error: implicit declaration of function '__xchg_called_with_bad_pointer'
make[2]: *** [init/main.o] Error 1

<-- snip -->

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-

To: Adrian Bunk <bunk@...>
Cc: <akpm@...>, <linux-kernel@...>, Christoph Lameter <clameter@...>, <takata@...>, <linux-m32r@...>
Date: Sunday, August 19, 2007 - 7:12 am

Fix m32r __xchg (revised)

the #endif /* CONFIG_SMP */ should cover the default condition, or it may cause
bad parameter to be silently missed.

To make it work correctly, we have to remove the ifdef CONFIG SMP surrounding
__xchg_called_with_bad_pointer declaration. Thanks to Adrian Bunk for
detecting this.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: takata@linux-m32r.org
CC: linux-m32r@ml.linux-m32r.org
CC: Adrian Bunk <bunk@kernel.org>
---
include/asm-m32r/system.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6-lttng/include/asm-m32r/system.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-m32r/system.h 2007-08-13 18:21:02.000000000 -0400
+++ linux-2.6-lttng/include/asm-m32r/system.h 2007-08-19 07:08:26.000000000 -0400
@@ -127,9 +127,7 @@ static inline void local_irq_disable(voi
((__typeof__(*(ptr)))__xchg_local((unsigned long)(x),(ptr), \
sizeof(*(ptr))))

-#ifdef CONFIG_SMP
extern void __xchg_called_with_bad_pointer(void);
-#endif

#ifdef CONFIG_CHIP_M32700_TS1
#define DCACHE_CLEAR(reg0, reg1, addr) \
@@ -189,9 +187,9 @@ __xchg(unsigned long x, volatile void *
#endif /* CONFIG_CHIP_M32700_TS1 */
);
break;
+#endif /* CONFIG_SMP */
default:
__xchg_called_with_bad_pointer();
-#endif /* CONFIG_SMP */
}

local_irq_restore(flags);
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-

Previous thread: [patch 10/23] New cmpxchg_local (optimized for UP case) for m32r by Mathieu Desnoyers on Sunday, August 12, 2007 - 10:54 am. (1 message)

Next thread: [patch 12/23] local_t m32r use architecture specific cmpxchg_local by Mathieu Desnoyers on Sunday, August 12, 2007 - 10:54 am. (1 message)