Why don't we have atomic_set_mask()?

Detlef Vollmann dv at vollmann.ch
Thu Mar 17 09:25:05 EDT 2011


On 03/17/11 13:07, Russell King - ARM Linux wrote:
> On Thu, Mar 17, 2011 at 08:36:15PM +0900, KyongHo Cho wrote:
>> arch/arm/asm/atomic.h defines atomic_clear_mask() but its counterpart,
>> atomic_set_mask() is not defined.
>
> Nothing other than some s390 drivers seems to use it, so I'd say no.
> I also feel that atomic_xxx() is over-used, many times in inappropriate
> and buggy ways.
I fully agree.  Simply asking for a atomic_set_mask looks like you're
trying to do something wrong.
The convention is to use those bits as flags, and having the contention
on setting the flag, so you have test_and_set_bit(), and can then
deal with the case where the flag was already set.
Doing that with more than one flag at a time would get pretty complex.

   Detlef



More information about the linux-arm-kernel mailing list