[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 2/8] xen/riscv: allow write_atomic() to work with non-scalar types



On Mon, 2024-09-16 at 08:25 +0200, Jan Beulich wrote:
> On 13.09.2024 17:57, Oleksii Kurochko wrote:
> > Update the defintion of write_atomic() to support non-scalar types,
> > aligning it with the behavior of read_atomic().
> 
> "Aligning" would imo imply yet more similarity. Types are different,
> names are different. How about "bringing it closer to"?
> 
> > --- a/xen/arch/riscv/include/asm/atomic.h
> > +++ b/xen/arch/riscv/include/asm/atomic.h
> > @@ -69,10 +69,11 @@ static always_inline void
> > _write_atomic(volatile void *p,
> >      }
> >  }
> >  
> > -#define write_atomic(p, x)                              \
> > -({                                                      \
> > -    typeof(*(p)) x_ = (x);                              \
> > -    _write_atomic(p, x_, sizeof(*(p)));                 \
> > +#define write_atomic(p,
> > x)                                              \
> > +({                                                                
> >       \
> > +    union { typeof(*(p)) v; unsigned long v_ul; } x_ = { .v_ul =
> > 0UL }; \
> > +    x_.v =
> > (x);                                                         \
> > +    _write_atomic(p, x_.v_ul,
> > sizeof(*(p)));                            \
> 
> v_ul is an odd name for my taste. Why not just ul, which is closer to
> read_atomic()'s c? Preferably with the adjustments (which I guess
> could
> be done while committing, so long as you agree)
I will be happy with that.

> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Thanks.

~ Oleksii

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.