Web lists-archives.com

Re: [PATCH 1/2] cifs: remove unused status severity defines




On (03/14/19 02:19), Steve French wrote:
> All of those uses of __constant_cpu_to_le32 apparently (at least
> according to checkpatch) should be changed (someday) to cpu_to_le32
> but I didn't research why the change from __constant_cpu_to_le32
> --->   cpu_to_le32

Probably historic reasons.

Looking at linux 2.4.21

/*
 * Allow constant folding
 */
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
#  define __swahw32(x) \
(__builtin_constant_p((__u32)(x)) ? \
 ___swahw32((x)) : \
 __fswahw32((x)))


My assumption would be that __GNUC__ < 2 did no support
__builtin_constant_p?


> If it has benefit - and checkpatch is right (it warned about
> __constant_cpu_to_le32 being no longer preferred) ... perhaps would be
> worth a followup patch to clean the rest of them up?   If you have any
> context on why kernel code has moved away from using the older format
> of __constant_cpu_to_.... would be useful to know if any benefit to
> the change

Right, that's what I'm going to do - send out patches and update the rest
of __constant_cpu_to_XX users; so, eventually, __constant_cpu_to_XX
can be removed.

	-ss