Skip to content

Commit ee2daf7

Browse files
committed
LoongArch: Add __percpu annotation for __percpu_read()/__percpu_write()
When build kernel with C=1, we get: arch/loongarch/kernel/process.c:234:46: warning: incorrect type in argument 1 (different address spaces) arch/loongarch/kernel/process.c:234:46: expected void *ptr arch/loongarch/kernel/process.c:234:46: got unsigned long [noderef] __percpu * arch/loongarch/kernel/process.c:234:46: warning: incorrect type in argument 1 (different address spaces) arch/loongarch/kernel/process.c:234:46: expected void *ptr arch/loongarch/kernel/process.c:234:46: got unsigned long [noderef] __percpu * arch/loongarch/kernel/process.c:234:46: warning: incorrect type in argument 1 (different address spaces) arch/loongarch/kernel/process.c:234:46: expected void *ptr arch/loongarch/kernel/process.c:234:46: got unsigned long [noderef] __percpu * arch/loongarch/kernel/process.c:234:46: warning: incorrect type in argument 1 (different address spaces) arch/loongarch/kernel/process.c:234:46: expected void *ptr arch/loongarch/kernel/process.c:234:46: got unsigned long [noderef] __percpu * Add __percpu annotation for __percpu_read()/__percpu_write() can avoid such warnings. __percpu_xchg() and other functions don't need annotation because their wrapper, i.e. _pcp_protect(), already suppresses warnings. Also adjust the indentations in this file. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Huacai Chen <[email protected]>
1 parent aa0cbc1 commit ee2daf7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

arch/loongarch/include/asm/percpu.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ static __always_inline unsigned long __percpu_##op(void *ptr, \
4040
switch (size) { \
4141
case 4: \
4242
__asm__ __volatile__( \
43-
"am"#asm_op".w" " %[ret], %[val], %[ptr] \n" \
43+
"am"#asm_op".w" " %[ret], %[val], %[ptr] \n" \
4444
: [ret] "=&r" (ret), [ptr] "+ZB"(*(u32 *)ptr) \
4545
: [val] "r" (val)); \
4646
break; \
4747
case 8: \
4848
__asm__ __volatile__( \
49-
"am"#asm_op".d" " %[ret], %[val], %[ptr] \n" \
49+
"am"#asm_op".d" " %[ret], %[val], %[ptr] \n" \
5050
: [ret] "=&r" (ret), [ptr] "+ZB"(*(u64 *)ptr) \
5151
: [val] "r" (val)); \
5252
break; \
@@ -63,7 +63,7 @@ PERCPU_OP(and, and, &)
6363
PERCPU_OP(or, or, |)
6464
#undef PERCPU_OP
6565

66-
static __always_inline unsigned long __percpu_read(void *ptr, int size)
66+
static __always_inline unsigned long __percpu_read(void __percpu *ptr, int size)
6767
{
6868
unsigned long ret;
6969

@@ -100,7 +100,7 @@ static __always_inline unsigned long __percpu_read(void *ptr, int size)
100100
return ret;
101101
}
102102

103-
static __always_inline void __percpu_write(void *ptr, unsigned long val, int size)
103+
static __always_inline void __percpu_write(void __percpu *ptr, unsigned long val, int size)
104104
{
105105
switch (size) {
106106
case 1:
@@ -132,8 +132,7 @@ static __always_inline void __percpu_write(void *ptr, unsigned long val, int siz
132132
}
133133
}
134134

135-
static __always_inline unsigned long __percpu_xchg(void *ptr, unsigned long val,
136-
int size)
135+
static __always_inline unsigned long __percpu_xchg(void *ptr, unsigned long val, int size)
137136
{
138137
switch (size) {
139138
case 1:

0 commit comments

Comments
 (0)