Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760976AbYCXQRb (ORCPT ); Mon, 24 Mar 2008 12:17:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753474AbYCXQRV (ORCPT ); Mon, 24 Mar 2008 12:17:21 -0400 Received: from gprs189-60.eurotel.cz ([160.218.189.60]:1389 "EHLO spitz.ucw.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752851AbYCXQRU (ORCPT ); Mon, 24 Mar 2008 12:17:20 -0400 Date: Sun, 23 Mar 2008 14:59:40 +0100 From: Pavel Machek To: Harvey Harrison Cc: Al Viro , Andrew Morton , LKML , linux-netdev Subject: Re: [RFC PATCH] kernel: add byteorder macros with alignment fixups Message-ID: <20080323135939.GC4580@ucw.cz> References: <1206034454.17059.4.camel@brick> <20080320182911.GQ10722@ZenIV.linux.org.uk> <1206038244.17059.7.camel@brick> <20080320190953.GR10722@ZenIV.linux.org.uk> <1206040953.17059.13.camel@brick> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1206040953.17059.13.camel@brick> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1604 Lines: 48 On Thu 2008-03-20 12:22:33, Harvey Harrison wrote: > Create linux/unaligned.h to hold a common pattern in the kernel: > > le32_to_cpu(get_unaligned((__le32 *)x)); > > Repeat for various combinations of le/be and 64/32/16 bit. Add > a variant that operates on possibly unaligned pointers to > byteorder/generic.h > > Signed-off-by: Harvey Harrison > --- > Now the indirect include of asm/unaligned is opt-in when places > add the linux/unaligned header. > > include/linux/unaligned.h | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 42 insertions(+), 0 deletions(-) > > diff --git a/include/linux/unaligned.h b/include/linux/unaligned.h > new file mode 100644 > index 0000000..7d8fddc > --- /dev/null > +++ b/include/linux/unaligned.h > @@ -0,0 +1,42 @@ > +#ifndef _LINUX_UNALIGNED_H_ > +#define _LINUX_UNALIGNED_H_ > + > +#include > +#include > +#include > + > +#ifdef __KERNEL__ > + > +static inline u64 le64_to_cpu_unaligned(void *p) > +{ > + return __le64_to_cpu(get_unaligned((__le64 *)p)); > +} Why the cast? Should le64_to_cpu() take __le64 * parameter, so that normal typechecking still works? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/