lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation
    On Wed, Apr 4, 2018 at 5:52 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
    > On 4/3/2018 6:29 PM, Palmer Dabbelt wrote:
    >>
    >
    > Are we looking for something like this?

    Yes, exactly, plus the same for write and in/out of course.

    > diff --git a/inc
    > #ifndef readb
    > #define readb readb
    > -static inline u8 readb(const volatile void __iomem *addr)
    > -{
    > - return __raw_readb(addr);
    > -}
    > +#define readb(c) \
    > + ({ u8 __v; \
    > + __io_br(); \
    > + __v = __raw_readb(c); \
    > + __io_ar(); \
    > + __v; })
    > #endif

    I would prefer leaving these as inline functions, but that's only
    a cosmetic difference.

    Arnd

    \
     
     \ /
      Last update: 2018-04-04 17:56    [W:3.612 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site