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 1/2] byteorder: add load/store_{endian} API
Date: Mon, 02 Mar 2009 18:09:19 -0800	[thread overview]
Message-ID: <1236046159.5756.43.camel@brick> (raw)
In-Reply-To: <alpine.LFD.2.00.0903021749030.3111@localhost.localdomain>

On Mon, 2009-03-02 at 17:51 -0800, Linus Torvalds wrote:
> 
> On Mon, 2 Mar 2009, Harvey Harrison wrote:
> > 
> > OK, static inline it is then. Would you be opposed to an API like:
> > 
> > get_le16
> > put_le16
> > 
> > to match with 
> >
> > get_unaligned_le16
> > put_unaligned_le16
> > 
> > And make the existing unaligned helpers typesafe?
> 
> That sounds much better to me. That said, I'm also wondering what the 
> upside is of this all?
> 

1) Recognize that some drivers/subsystems want this, or already
implement it privately

2) [micro-optimization] Allow arches that do provide load/store swapped
instructions to be used more often.

3) make it more likely that people will actually use the unaligned
helpers rather than open-coding the byteswapping, allowing arches that
have no alignment constraints to just do regular loads if possible.

Disadvantages:

1) existing users of the get_unaligned bits may/will produce sparse
warnings on the flag day

2) the existing argument ordering of put_unaligned is opposite what
is usually expected in such a helper

3) [nitpicky] get/put almost always means reference taking/releasing,
load/store is the usual verb used for such an API.

Harvey


      reply	other threads:[~2009-03-03  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03  0:06 [PATCH 1/2] byteorder: add load/store_{endian} API Harvey Harrison
2009-03-03  0:15 ` Linus Torvalds
2009-03-03  0:25   ` Harvey Harrison
2009-03-03  0:37     ` Linus Torvalds
2009-03-03  0:40       ` Harvey Harrison
2009-03-03  1:51         ` Linus Torvalds
2009-03-03  2:09           ` 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=1236046159.5756.43.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