mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mm-commits@vger.kernel.org, harvey.harrison@gmail.com,
	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:21:48 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0811190919280.27671@anakin> (raw)
In-Reply-To: <200811190614.mAJ6EsXA007330@imap1.linux-foundation.org>

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);

> +}
> +
> +static inline void __put_le64_noalign(u8 *p, u64 val)
> +{
> +	__put_le32_noalign(p + 4, val >> 32);
> +	__put_le32_noalign(p, val);

Same here:

	__put_le32_noalign(p, val);
	__put_le32_noalign(p + 4, val >> 32);

> +}

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

       reply	other threads:[~2008-11-19  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200811190614.mAJ6EsXA007330@imap1.linux-foundation.org>
2008-11-19  8:21 ` Geert Uytterhoeven [this message]
2008-11-19 17:16   ` 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=Pine.LNX.4.64.0811190919280.27671@anakin \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bryan.wu@analog.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=gerg@uclinux.org \
    --cc=grundler@parisc-linux.org \
    --cc=harvey.harrison@gmail.com \
    --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

all inboxes | Powered by JetHome®