[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1319996494.13597.69.camel@edumazet-laptop>
Date: Sun, 30 Oct 2011 18:41:34 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andi Kleen <andi@...stfloor.org>,
Ben Hutchings <bhutchings@...arflare.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: >Re: [RFC] should VM_BUG_ON(cond) really evaluate cond
Le dimanche 30 octobre 2011 à 10:07 -0700, Linus Torvalds a écrit :
> On Sun, Oct 30, 2011 at 8:16 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> >
> > Because it doesnt work if x is const.
>
> Just remove the const. Problem solved.
>
> Both cases of 'const' are totally arbitrary and useless. The
> test_bit() one is literally a cast to const (admittedly also *from*
> const, but nobody cares), and the atomic_read() one is just because it
> uses a silly inline function where a macro would be simpler.
>
Oh well, I am lost. I always considered inline functione better because
of prototype checks.
Changing atomic_read(const atomic_t *v) prototype to
atomic_read(atomic_t *v) is not an option.
To save your time and my time, please select your favorite between :
1) The patch I did
2)
static inline int atomic_read(const atomic_t *v)
{
return ACCESS_AT_MOST_ONCE(((atomic_t *)v)->counter);
}
3)
static inline int atomic_read(const atomic_t *v)
{
return ACCESS_AT_MOST_ONCE(*(int *)&(v)->counter);
}
4) macro (I personnaly dont like it)
#define atomic_read(v) ACCESS_AT_MOST_ONCE(*(int *)&(v)->counter)
Thanks
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists