|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 10/19] xen/riscv: introduce atomic.h
On Mon, 2024-04-08 at 10:23 +0200, Jan Beulich wrote:
> > +static always_inline void _add_sized(volatile void *p,
> > + unsigned long x, unsigned int
> > size)
> > +{
> > + switch ( size )
> > + {
> > + case 1: writeb(read_atomic((volatile uint8_t *)p) + x, p);
> > break;
> > + case 2: writew(read_atomic((volatile uint16_t *)p) + x, p);
> > break;
> > + case 4: writel(read_atomic((volatile uint32_t *)p) + x, p);
> > break;
> > +#ifndef CONFIG_RISCV_32
> > + case 8: writeq(read_atomic((volatile uint64_t *)p) + x, p);
> > break;
> > +#endif
>
> Any particular reason for using read_atomic() but write{b,w,l,q}()
> here?
It was done because write_atomic() wants to have pointer as a first
argument, but read_atomic() returns a value.
As an option it can be used read{b,w,l,q}() instead of read_atomic() to
have the code consistent with write{b,w,l,q}.
Another option is to left as is and add the comment.
~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |