lkml.org 
[lkml]   [2008]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] byteorder: force in-place endian conversion to always evaluate args
From
Date
On Fri, 2008-07-25 at 11:22 -0700, Nish Aravamudan wrote:
> On 7/25/08, Harvey Harrison <harvey.harrison@gmail.com> wrote:
> > David Miller reported breakage in ide when the in-place byteorder helpers
> > were used as the macros do not always evaluate their args which led to
> > an infinite loop.
> >
> > Just make them functions to ensure they always do so.
> >
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> > ---
> > include/linux/byteorder/big_endian.h | 60 ++++++++++++++++++++++++------
> > include/linux/byteorder/little_endian.h | 60 ++++++++++++++++++++++++------
> > 2 files changed, 96 insertions(+), 24 deletions(-)
> >
> > diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
> > index 961ed4b..b53ccd0 100644
> > --- a/include/linux/byteorder/big_endian.h
> > +++ b/include/linux/byteorder/big_endian.h
> > @@ -88,18 +88,54 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
> > {
> > return (__force __u16)*p;
> > }
> > -#define __cpu_to_le64s(x) __swab64s((x))
> > -#define __le64_to_cpus(x) __swab64s((x))
> > -#define __cpu_to_le32s(x) __swab32s((x))
> > -#define __le32_to_cpus(x) __swab32s((x))
> > -#define __cpu_to_le16s(x) __swab16s((x))
> > -#define __le16_to_cpus(x) __swab16s((x))
> > -#define __cpu_to_be64s(x) do {} while (0)
> > -#define __be64_to_cpus(x) do {} while (0)
> > -#define __cpu_to_be32s(x) do {} while (0)
> > -#define __be32_to_cpus(x) do {} while (0)
> > -#define __cpu_to_be16s(x) do {} while (0)
> > -#define __be16_to_cpus(x) do {} while (0)
> > +
> > +static inline void __cpu_to_le64s(__u64 *p)
> > +{
> > + __swab64s(x);
> > +}
>
> Shouldn't all the x's in the function bodies be p's? And I thought
> David already posted a macro version of this change along the lines of
> hpa's reply?

*sigh*

Yes they should, I sent the wrong mbox after this failed to compile
and fixed it.

Cheers,

Harvey



\
 
 \ /
  Last update: 2008-07-25 20:29    [W:0.070 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site