Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1181414

Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions
Date 2015-07-10 11:20 +0200
Message-ID <pKCDo-44s-23@gated-at.bofh.it> (permalink)
References <pKoh3-3bp-3@gated-at.bofh.it> <pKoqJ-3ul-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Peter,

On Thu, Jul 9, 2015 at 7:29 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> --- a/include/linux/atomic.h
> +++ b/include/linux/atomic.h
> @@ -28,6 +28,23 @@ static inline int atomic_add_unless(atom
>  #define atomic_inc_not_zero(v)         atomic_add_unless((v), 1, 0)
>  #endif
>
> +#ifndef atomic_nand
> +static inline void atomic_nand(int i, atomic_t *v)
> +{
> +       atomic_and(~i, v);

That sounds like a misnomer...

Your NAND is "A & ~B", while my[*] NAND is "~(A & B)"?

[*] https://en.wikipedia.org/wiki/NAND_logic

What about atomic_clear()? (Is atomic_bic() too ARM-centric?)

> +}
> +#endif
> +
> +static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
> +{
> +       atomic_nand(mask, v);
> +}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions Geert Uytterhoeven <geert@linux-m68k.org> - 2015-07-10 11:20 +0200
  Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask  definitions Peter Zijlstra <peterz@infradead.org> - 2015-07-10 18:30 +0200
    Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask  definitions Chris Metcalf <cmetcalf@ezchip.com> - 2015-07-10 19:40 +0200

csiph-web