Re: [PATCH 03/20] arch,arc: Fold atomic_ops

From: Peter Zijlstra
Date: Fri May 09 2014 - 06:22:36 EST


On Fri, May 09, 2014 at 09:34:51AM +0000, Vineet Gupta wrote:
> Hi Peter,
>
> Minor point below, otherwise looks good.
>
> > +#define atomic_clear_mask(mask, v) atomic_and(~(mask), (v))
>
> Given that ARC has instruction to do just that, can we keep below instead.
>
> ATOMIC_OP(clear_mask, ~=, bic)
>
> (see asm version of atomic_clear_mask)

Ah, yes I did notices that.

The thing is, I was going to kill clear_mask in the next set.

I'm going to introduce: atomic_{or,and,xor}() and replace all
atomic_set_mask() with atomic_or() and atomic_clear_mask() with
atomic_and(~(mask)).

One of the 'problems' is that atomic_{set,clear}_mask() are not
available on all archs and its a 'weird' interface in so far as that
most our other primitives are or/and based, I don't think we have nand.

But if people really want I suppose I could also add atomic_nand().

Attachment: pgpkxn7SnNRr7.pgp
Description: PGP signature