LoongArch: Mark __xchg() and __cmpxchg() as __always_inline
Commitac7c3e4ff4
("compiler: enable CONFIG_OPTIMIZE_INLINING forcibly") allows compiler to uninline functions marked as 'inline'. In case of __xchg()/__cmpxchg() this would cause to reference BUILD_BUG(), which is an error case for catching bugs and will not happen for correct code, if __xchg()/__cmpxchg() is inlined. This bug can be produced with CONFIG_DEBUG_SECTION_MISMATCH enabled, and the solution is similar to below commits:46f1619500
("MIPS: include: Mark __xchg as __always_inline"),88356d0990
("MIPS: include: Mark __cmpxchg as __always_inline"). Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
1299a129a9
commit
ddf502717d
@ -61,8 +61,8 @@ static inline unsigned int __xchg_small(volatile void *ptr, unsigned int val,
|
|||||||
return (old32 & mask) >> shift;
|
return (old32 & mask) >> shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long __xchg(volatile void *ptr, unsigned long x,
|
static __always_inline unsigned long
|
||||||
int size)
|
__xchg(volatile void *ptr, unsigned long x, int size)
|
||||||
{
|
{
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -159,8 +159,8 @@ static inline unsigned int __cmpxchg_small(volatile void *ptr, unsigned int old,
|
|||||||
return (old32 & mask) >> shift;
|
return (old32 & mask) >> shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
static __always_inline unsigned long
|
||||||
unsigned long new, unsigned int size)
|
__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, unsigned int size)
|
||||||
{
|
{
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user