Re: [Intel-gfx] [PATCH 1/5] linux/minmax.h: add non-atomic version of xchg
From: Mark Rutland
Date: Thu Jan 05 2023 - 11:17:00 EST
On Thu, Jan 05, 2023 at 03:57:25PM +0100, Daniel Vetter wrote:
> It's more fun, for the atomic functions which don't have the atomic_
> prefix in their names, the __ prefixed versions provide the non-atomic
> implementation. This pattern was started with the long * bitops stuff for
> managing really big bitmasks.
>
> And I really don't think it's a great function name scheme that we should
> proliferate.
FWIW I agree it's not great, but we're stuck between a rock and a bikeshed
w.r.t. better naming -- it's quite hard to clean that up becuase the atomic_*()
namespace is reserved for atomic_t (and mirrors atomic64_*() and
atomic_long_*()).
We could consider renaming atomic_t to atomic32_t and atomic_*() to
atomic32_*(), which'd free up the atomic_*() namespace for more genral usage
(e.g. allowing us to have atomic_xchg() and xhcg(), with the latter not being
atomic).
Thanks,
Mark.