public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Boaz Harrosh <bharrosh@panasas.com>
Subject: Re: [PATCH 2/2] unaligned: add load/store_{endian}_noalign API
Date: Mon, 02 Mar 2009 16:38:10 -0800	[thread overview]
Message-ID: <1236040690.5756.31.camel@brick> (raw)
In-Reply-To: <alpine.LFD.2.00.0903021616440.3111@localhost.localdomain>

On Mon, 2009-03-02 at 16:18 -0800, Linus Torvalds wrote:
> 
> On Mon, 2 Mar 2009, Harvey Harrison wrote:
> >
> > Add a typed API with the usual argument ordering and use load/store,
> > this API is also consistent with the aligned versions.
> 
> This naming is horrible. It doesn't match the normal pattern we have in 
> the kernel. 
> 
> Why not just try to fix the current (well-named) "get_unaligned_le16()" 
> problems, instead of introducing a new (and badly named) version of them.
> 
> So NAK on both of these.

Well, the current API can be made typesafe, and then the sparse fallout
can be fixed...I introduced the new API to make it opt-in and then
phase out the old API over time to avoid that.  As I already had a new
API, 'fixing' the argument order was doable as well.  Comments from AKPM
made me drop the get/put name as well, and load/store seemed the most
natural replacement.

The other reason was currently we have:

Aligned:
le16_to_cpup

Unaligned:
get_unaligned_le16
put_unaligned_le16

And although the le16_to_cpup is at worst the same as le16_to_cpu(*p) it
is more efficient on arches like powerpc and sparc that have a load-swap
instruction...but few people use it because of the goofy name.  Same goes
for the get/put_unaligned, people don't use them and just open-code the
byteswapping whenever there is going to be unaligned access.

So I was hoping to make it easier/more obvious to use as well.

Aligned:
load_le16
store_le16

Unaligned (which degrades to aligned on arches without alignment restrictions)
load_le16_noalign
store_le16_noalign

Cheers,

Harvey


      reply	other threads:[~2009-03-03  0:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03  0:06 [PATCH 2/2] unaligned: add load/store_{endian}_noalign API Harvey Harrison
2009-03-03  0:18 ` Linus Torvalds
2009-03-03  0:38   ` 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=1236040690.5756.31.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bharrosh@panasas.com \
    --cc=geert@linux-m68k.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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