From patchwork Mon Jun 20 20:50:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 898572 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5KKovCA028689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 20 Jun 2011 20:51:19 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QYlQi-0005BM-U3; Mon, 20 Jun 2011 20:50:45 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QYlQi-00020n-3C; Mon, 20 Jun 2011 20:50:44 +0000 Received: from relais.videotron.ca ([24.201.245.36]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QYlQa-00020T-Sp for linux-arm-kernel@lists.infradead.org; Mon, 20 Jun 2011 20:50:42 +0000 MIME-version: 1.0 Received: from xanadu.home ([66.130.28.92]) by vl-mh-mrz25.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0LN300DEQWGOPU70@vl-mh-mrz25.ip.videotron.ca> for linux-arm-kernel@lists.infradead.org; Mon, 20 Jun 2011 16:48:24 -0400 (EDT) Date: Mon, 20 Jun 2011 16:50:34 -0400 (EDT) From: Nicolas Pitre X-X-Sender: nico@xanadu.home To: Arnd Bergmann Subject: Re: [PATCH] USB: ehci: use packed, aligned(4) instead of removing the packed attribute In-reply-to: <201106202226.37381.arnd@arndb.de> Message-id: References: <20110620184849.GI26089@n2100.arm.linux.org.uk> <201106202226.37381.arnd@arndb.de> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110620_165037_014817_B0306D43 X-CRM114-Status: GOOD ( 20.94 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [24.201.245.36 listed in list.dnswl.org] Cc: linux-usb@vger.kernel.org, Russell King - ARM Linux , gregkh@suse.de, lkml , Rabin Vincent , Alan Stern , Alexander Holler , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 20 Jun 2011 20:51:19 +0000 (UTC) On Mon, 20 Jun 2011, Arnd Bergmann wrote: > On Monday 20 June 2011 20:48:49 Russell King - ARM Linux wrote: > > If it is the case that these structures do not require packing to get > > their desired layout, then they don't require packing, and the packed > > attribute should be dropped. > > Yes. But are you going to audit every other use of __packed in the kernel > to check if it is used on __iomem pointers? The compiler might tell us about it: And similar for readh/writeh, given that your GCC version is preserving the alignment attribute across the cast of course. [...] Scratch that. The alignment of a void pointer dereference is 1. Nicolas diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index d66605d..10c47e8 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -49,11 +49,11 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); #define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v)) #define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)) -#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v)) +#define __raw_writel(v,a) (__chk_io_ptr(a), BUILD_BUG_ON_ZERO(__alignof(*(int *)a) != 4), *(volatile unsigned int __force *)(a) = (v)) #define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) #define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a)) -#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) +#define __raw_readl(a) (__chk_io_ptr(a), BUILD_BUG_ON_ZERO(__alignof(*(int *)a) != 4), *(volatile unsigned int __force *)(a)) /* * Architecture ioremap implementation.