Re: [PATCH V2] fs/reiserfs/stree.c: remove obsolete __constant

From: Joe Perches
Date: Wed May 14 2014 - 18:27:15 EST


On Thu, 2014-05-15 at 00:08 +0200, Richard Weinberger wrote:
> On Thu, May 15, 2014 at 12:01 AM, Jan Kara <jack@xxxxxxx> wrote:
> > On Sat 03-05-14 22:33:24, Fabian Frederick wrote:
> >> __constant_cpu_to_le32 converted to cpu_to_le32
> >>
> >> Cc: reiserfs-devel@xxxxxxxxxxxxxxx
> >> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> >> Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
> > Just for my education, where have you learned that __constant_...
> > functions are obsolete?
>
> IIRC checkpatch.pl barks if you use __constant_... outside of include/uapi/

I'd use not preferred and unnecessarily verbose more than obsolete.

These conversions are all tested with __builtin_constant_p
via indirection to macros like __swab32

include/uapi/linux/swab.h:#define __swab32(x) \
include/uapi/linux/swab.h- (__builtin_constant_p((__u32)(x)) ? \
include/uapi/linux/swab.h- ___constant_swab32(x) : \
include/uapi/linux/swab.h- __fswab32(x))

include/uapi/linux/swab.h:#define ___constant_swab32(x) ((__u32)( \
include/uapi/linux/swab.h- (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
include/uapi/linux/swab.h- (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
include/uapi/linux/swab.h- (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
include/uapi/linux/swab.h- (((__u32)(x) & (__u32)0xff000000UL) >> 24)))


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/