diff options
| author | Peter Zijlstra <[email protected]> | 2018-06-05 16:53:34 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2018-06-28 21:07:55 +0900 |
| commit | 5fd691afdf929061c391d897fa627822c3b2fd5a (patch) | |
| tree | 005d50f2b2bc10ce6e6af270feaa1fc1efe77eae /scripts/gcc-plugins/cyc_complexity_plugin.c | |
| parent | 9d9398944488cd3a3e1e0912b26fbc4d5921e547 (diff) | |
atomic/tty: Fix up atomic abuse in ldsem
Mark found ldsem_cmpxchg() needed an (atomic_long_t *) cast to keep
working after making the atomic_long interface type safe.
Needing casts is bad form, which made me look at the code. There are no
ld_semaphore::count users outside of these functions so there is no
reason why it can not be an atomic_long_t in the first place, obviating
the need for this cast.
That also ensures the loads use atomic_long_read(), which implies (at
least) READ_ONCE() in order to guarantee single-copy-atomic loads.
When using atomic_long_try_cmpxchg() the ldsem_cmpxchg() wrapper gets
very thin (the only difference is not changing *old on success, which
most callers don't seem to care about).
So rework the whole thing to use atomic_long_t and its accessors
directly.
While there, fixup all the horrible comment styles.
Cc: Peter Hurley <[email protected]>
Reported-by: Mark Rutland <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'scripts/gcc-plugins/cyc_complexity_plugin.c')
0 files changed, 0 insertions, 0 deletions