locking/atomic: atomic64: remove unusable atomics
PATCH 1/1 locking/atomic: atomic64: remove unusable atomics
The generic atomic64 implementation provides:
* atomic64_and_return()
* atomic64_or_return()
* atomic64_xor_return()
... but none of these exist in the standard atomic64 API as described by scripts/atomic/atomics.tbl, and none of these have prototypes exposed by <asm-generic/atomic64.h>.
The lkp kernel test robot noted this results in warnings when building with W=1:
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_and_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_or_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_xor_return' [-Wmissing-prototypes]
This appears to have been a thinko in commit:
28aa2bda2211f432 ("locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()")
... where we grouped add/sub separately from and/ox/xor, so that we could avoid implementing _return forms for the latter group, but forgot to remove ATOMIC64_OP_RETURN() for that group.
This doesn't cause any functional problem, but it's pointless to build code which cannot be used. Remove the unusable code. This does not affect add/sub, for which _return forms will still be built.
--- lib/atomic64.c | 2 -- 1 file changed, 2 deletions(-)
lib/atomic64.c +0 -2
@@ -118,7 +118,6 @@ ATOMIC64_OPS(sub, -=)#undef ATOMIC64_OPS#define ATOMIC64_OPS (op, c_op) \ ATOMIC64_OP(op, c_op) \ - ATOMIC64_OP_RETURN(op, c_op) \ ATOMIC64_FETCH_OP(op, c_op) ATOMIC64_OPS(and, &=)
@@ -127,7 +126,6 @@ ATOMIC64_OPS(xor, ^=)#undef ATOMIC64_OPS#undef ATOMIC64_FETCH_OP -#undef ATOMIC64_OP_RETURN#undef ATOMIC64_OPs64 generic_atomic64_dec_if_positive (atomic64_t *v)
Signature · 1 line
2.30.2
Quoted 27 lines · Mark Rutland
The generic atomic64 implementation provides:
*
atomic64_and_return()
*atomic64_or_return()
*atomic64_xor_return()... but none of these exist in the standard atomic64 API as described by
scripts/atomic/atomics.tbl, and none of these have prototypes exposed by <asm-generic/atomic64.h>.The lkp kernel test robot noted this results in warnings when building with W=1:
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_and_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_or_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_xor_return' [-Wmissing-prototypes]This appears to have been a thinko in commit:
28aa2bda2211f432("locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()")... where we grouped add/sub separately from and/ox/xor, so that we could avoid implementing
_returnforms for the latter group, but forgot to removeATOMIC64_OP_RETURN()for that group.
Quoted 7 lines
This doesn't cause any functional problem, but it's pointless to build code which cannot be used. Remove the unusable code. This does not affect add/sub, for which
_returnforms will still be built.Reported-by kernel test robot <[email protected]>Signed-off-by Mark Rutland <[email protected]>
FWIW
Regards,
Boqun
Quoted 31 lines
Cc Arnd Bergmann <[email protected]>Cc Boqun Feng <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Will Deacon <[email protected]>--- lib/atomic64.c | 2 -- 1 file changed, 2 deletions(-)lib/atomic64.c +0
-2@@ -118,7 +118,6 @@ ATOMIC64_OPS(sub, -=)#undef ATOMIC64_OPS#define ATOMIC64_OPS (op, c_op) \ ATOMIC64_OP(op, c_op) \ - ATOMIC64_OP_RETURN(op, c_op) \ ATOMIC64_FETCH_OP(op, c_op) ATOMIC64_OPS(and, &=)@@ -127,7 +126,6 @@ ATOMIC64_OPS(xor, ^=)#undef ATOMIC64_OPS#undef ATOMIC64_FETCH_OP -#undef ATOMIC64_OP_RETURN#undef ATOMIC64_OPs64 generic_atomic64_dec_if_positive (atomic64_t *v)Signature · 1 line
2.30.2
Peter, did you have any thoughts on this, or would you be happy to pick it as a cleanup?
If there's anything on your queue that I can help to get out of the way, please let me know!
Thanks,
Mark.
Quoted 65 lines · Mark Rutland
The generic atomic64 implementation provides:
*
atomic64_and_return()
*atomic64_or_return()
*atomic64_xor_return()... but none of these exist in the standard atomic64 API as described by
scripts/atomic/atomics.tbl, and none of these have prototypes exposed by <asm-generic/atomic64.h>.The lkp kernel test robot noted this results in warnings when building with W=1:
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_and_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_or_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_xor_return' [-Wmissing-prototypes]This appears to have been a thinko in commit:
28aa2bda2211f432("locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()")... where we grouped add/sub separately from and/ox/xor, so that we could avoid implementing
_returnforms for the latter group, but forgot to removeATOMIC64_OP_RETURN()for that group.This doesn't cause any functional problem, but it's pointless to build code which cannot be used. Remove the unusable code. This does not affect add/sub, for which
_returnforms will still be built.Reported-by kernel test robot <[email protected]>Signed-off-by Mark Rutland <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Boqun Feng <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Will Deacon <[email protected]>--- lib/atomic64.c | 2 -- 1 file changed, 2 deletions(-)lib/atomic64.c +0
-2@@ -118,7 +118,6 @@ ATOMIC64_OPS(sub, -=)#undef ATOMIC64_OPS#define ATOMIC64_OPS (op, c_op) \ ATOMIC64_OP(op, c_op) \ - ATOMIC64_OP_RETURN(op, c_op) \ ATOMIC64_FETCH_OP(op, c_op) ATOMIC64_OPS(and, &=)@@ -127,7 +126,6 @@ ATOMIC64_OPS(xor, ^=)#undef ATOMIC64_OPS#undef ATOMIC64_FETCH_OP -#undef ATOMIC64_OP_RETURN#undef ATOMIC64_OPs64 generic_atomic64_dec_if_positive (atomic64_t *v)Signature · 1 line
2.30.2
Quoted 6 lines · Mark Rutland
Peter, did you have any thoughts on this, or would you be happy to pick it as a cleanup?
If there's anything on your queue that I can help to get out of the way, please let me know!
I think it's good, it just got lost in this trainwreck of an inbox. I'll try not to loose it again :-)
[tip: locking/core] locking/atomic: atomic64: Remove unusable atomic ops
In reply to Mark RutlandThe following commit has been merged into the locking/core branch of tip:
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 5fb6e8cf53b005d287d4c2d137a415ff7d025a81 Gitweb: https://git.kernel.org/tip/5fb6e8cf53b005d287d4c2d137a415ff7d025a81 Author: Mark Rutland <[email protected]> AuthorDate: Fri, 26 Nov 2021 11:59:23 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 13 Dec 2021 10:56:09 +01:00
locking/atomic: atomic64: Remove unusable atomic ops
The generic atomic64 implementation provides:
* atomic64_and_return()
* atomic64_or_return()
* atomic64_xor_return()
... but none of these exist in the standard atomic64 API as described by scripts/atomic/atomics.tbl, and none of these have prototypes exposed by <asm-generic/atomic64.h>.
The lkp kernel test robot noted this results in warnings when building with W=1:
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_and_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_or_return' [-Wmissing-prototypes]
lib/atomic64.c:82:5: warning: no previous prototype for 'generic_atomic64_xor_return' [-Wmissing-prototypes]
This appears to have been a thinko in commit:
28aa2bda2211f432 ("locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()")
... where we grouped add/sub separately from and/ox/xor, so that we could avoid implementing _return forms for the latter group, but forgot to remove ATOMIC64_OP_RETURN() for that group.
This doesn't cause any functional problem, but it's pointless to build code which cannot be used. Remove the unusable code. This does not affect add/sub, for which _return forms will still be built.
--- lib/atomic64.c | 2 -- 1 file changed, 2 deletions(-)
lib/atomic64.c +0 -2
@@ -118,7 +118,6 @@ ATOMIC64_OPS(sub, -=)#undef ATOMIC64_OPS#define ATOMIC64_OPS (op, c_op) \ ATOMIC64_OP(op, c_op) \ - ATOMIC64_OP_RETURN(op, c_op) \ ATOMIC64_FETCH_OP(op, c_op) ATOMIC64_OPS(and, &=)
@@ -127,7 +126,6 @@ ATOMIC64_OPS(xor, ^=)#undef ATOMIC64_OPS#undef ATOMIC64_FETCH_OP -#undef ATOMIC64_OP_RETURN#undef ATOMIC64_OPs64 generic_atomic64_dec_if_positive (atomic64_t *v)