public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	mm-commits@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	bryan.wu@analog.com, "David S. Miller" <davem@davemloft.net>,
	dhowells@redhat.com, Greg Ungerer <gerg@uclinux.org>,
	grundler@parisc-linux.org, heiko.carstens@de.ibm.com,
	hskinnemoen@atmel.com, ink@jurassic.park.msu.ru,
	kyle@mcmartin.ca, lethal@linux-sh.org,
	linux-arch@vger.kernel.org, mingo@elte.hu,
	Paul Mackerras <paulus@samba.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Russell King <rmk@arm.linux.org.uk>,
	rth@twiddle.net, schwidefsky@de.ibm.com, takata@linux-m32r.org,
	tglx@linutronix.de, tony.luck@intel.com,
	ysato@users.sourceforge.jp, zankel@tensilica.com,
	Roman Zippel <zippel@linux-m68k.org>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: + unaligned-introduce-common-header.patch added to -mm tree
Date: Wed, 19 Nov 2008 09:16:26 -0800	[thread overview]
Message-ID: <1227114986.13182.12.camel@brick> (raw)
In-Reply-To: <Pine.LNX.4.64.0811190919280.27671@anakin>

On Wed, 2008-11-19 at 09:21 +0100, Geert Uytterhoeven wrote:
> On Tue, 18 Nov 2008, akpm@linux-foundation.org wrote:
> > Subject: unaligned: introduce common header
> > From: Harvey Harrison <harvey.harrison@gmail.com>
> > 
> > There are two common cases in the kernel, one where unaligned access is OK
> > for an arch and one where the arch uses a packed-struct for the native
> > endianness and opencoded C byteshifting for the other endianness. 
> > Consolidate these two implementations in asm-generic/unaligned.h
> > 
> > Arches that require no special handling of unaligned access can define
> > _UNALIGNED_ACCESS_OK in their asm/unaligned.h before including the generic
> > version.
> > 
> > +static inline void __put_le32_noalign(u8 *p, u32 val)
> > +{
> > +	__put_le16_noalign(p + 2, val >> 16);
> > +	__put_le16_noalign(p, val);
> 
> Isn't it more logical to reverse the order, to store in increasing memory
> locations:
> 
> 	__put_le16_noalign(p, val);
> 	__put_le16_noalign(p + 2, val >> 16);
> 

All of the byteshifting versions were cribbed from the ARM implementation.

I'm not sure if there was a particular reason for doing it in this order, but
a lot of work seems to have gone in to minimize register usage.

See include/asm-arm/unaligned.h circa 2.6.25.

Harvey

  parent reply	other threads:[~2008-11-19 17:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19  6:14 + unaligned-introduce-common-header.patch added to -mm tree akpm
2008-11-19  8:21 ` Geert Uytterhoeven
2008-11-19  8:21   ` Geert Uytterhoeven
2008-11-19 17:16   ` Harvey Harrison [this message]
2008-11-19 18:59 ` Harvey Harrison

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=1227114986.13182.12.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bryan.wu@analog.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@uclinux.org \
    --cc=grundler@parisc-linux.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hskinnemoen@atmel.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kyle@mcmartin.ca \
    --cc=lethal@linux-sh.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mm-commits@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=rth@twiddle.net \
    --cc=schwidefsky@de.ibm.com \
    --cc=takata@linux-m32r.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=ysato@users.sourceforge.jp \
    --cc=zankel@tensilica.com \
    --cc=zippel@linux-m68k.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