[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv4 1/8] x86: provide arch_fetch_and_add()
>>> On 30.04.15 at 17:33, <david.vrabel@xxxxxxxxxx> wrote: > +static always_inline unsigned long __xadd( > + volatile void *ptr, unsigned long v, int size) > +{ > + switch ( size ) > + { > + case 1: > + asm volatile ( "lock; xaddb %b0,%1" > + : "+r" (v), "+m" (*__xg((volatile void *)ptr)) "ptr" already is "volatile void *", so why the cast? Or is this just an artifact of __xchg() doing the same odd thing? > +#define arch_fetch_and_add(ptr, v) \ > + ({ \ > + (typeof(*(ptr)))__xadd(ptr, (typeof(*(ptr)))(v), sizeof(*(ptr))); \ > + }) It being a single expression inside the braces I don't think you really need the ({}) GNU extension here. Both of course easily adjusted while committing, if you agree. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |