public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH 07/37] block: use get/put_endian helpers
Date: Fri, 30 May 2008 09:06:59 -0700	[thread overview]
Message-ID: <1212163619.28403.189.camel@brick> (raw)
In-Reply-To: <20080530072220.GG25504@kernel.dk>

On Fri, 2008-05-30 at 09:22 +0200, Jens Axboe wrote:
> On Thu, May 29 2008, Harvey Harrison wrote:
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> > ---
> >  drivers/block/cciss.c     |   11 +++++------
> >  drivers/block/paride/pd.c |    8 ++++----
> >  drivers/block/ub.c        |    4 ++--
> >  drivers/cdrom/cdrom.c     |    2 +-
> >  4 files changed, 12 insertions(+), 13 deletions(-)
> 
> What is the point of this? I'm honestly asking, what is the grand idea
> behind changing eg be32_to_cpu() to get_be32()?
> 

It started by introducing a put_be32(val, dest) to cover the idiom:

*(__be32 *)dest = cpu_to_be32(val);

I made put_be32 look like the existing put_unaligned_be32, essentially
adding an aligned helper.

Purely to make a symmetric api, I added the get_be32(ptr) which is
identical to be32_to_cpup (note the p suffix).

As part of this patchset I replaced places like:

be32_to_cpu(*(__be32 *)ptr) -> get_be32((__be32 *)ptr)

My initial version took a void *, but Al Viro requested I keep strict
typechecking, so I made it take a __be32 *.

This is profitable as some arches have an optimized return byte-swapped
from pointer implementation.  I could have just as easily replaced it
with be32_to_cpup.

Cheers,

Harvey

      reply	other threads:[~2008-05-30 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 20:18 [PATCH 07/37] block: use get/put_endian helpers Harvey Harrison
2008-05-30  7:22 ` Jens Axboe
2008-05-30 16:06   ` Harvey Harrison [this message]

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=1212163619.28403.189.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-arch@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox