linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Fabian Frederick <fabf@skynet.be>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	reiserfs-devel@vger.kernel.org, akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH V2] fs/reiserfs/stree.c: remove obsolete __constant
Date: Wed, 14 May 2014 15:27:05 -0700	[thread overview]
Message-ID: <1400106425.12666.6.camel@joe-AO725> (raw)
In-Reply-To: <CAFLxGvzp_8Qgg0wN2v0SncAB+eDEn4s-p86ZW9+DzosBKb53yw@mail.gmail.com>

On Thu, 2014-05-15 at 00:08 +0200, Richard Weinberger wrote:
> On Thu, May 15, 2014 at 12:01 AM, Jan Kara <jack@suse.cz> wrote:
> > On Sat 03-05-14 22:33:24, Fabian Frederick wrote:
> >> __constant_cpu_to_le32 converted to cpu_to_le32
> >>
> >> Cc: reiserfs-devel@vger.kernel.org
> >> Cc: Andrew Morton <akpm@linux-foundation.org>
> >> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> >   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)))



  reply	other threads:[~2014-05-14 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-03 20:33 Fabian Frederick
2014-05-14 22:01 ` Jan Kara
2014-05-14 22:08   ` Richard Weinberger
2014-05-14 22:27     ` Joe Perches [this message]
2014-05-14 22:29     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400106425.12666.6.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=fabf@skynet.be \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=richard.weinberger@gmail.com \
    --subject='Re: [PATCH V2] fs/reiserfs/stree.c: remove obsolete __constant' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).