From patchwork Thu Jun 16 16:17:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 887872 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5GGI5OY032479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Jun 2011 16:18:26 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXFGQ-0001kA-6l; Thu, 16 Jun 2011 16:17:50 +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 1QXFGP-0001sn-Ra; Thu, 16 Jun 2011 16:17:49 +0000 Received: from h1446028.stratoserver.net ([85.214.92.142] helo=mail.ahsoftware.de) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QXFGM-0001sU-FO for linux-arm-kernel@lists.infradead.org; Thu, 16 Jun 2011 16:17:47 +0000 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id 59A4D434618; Thu, 16 Jun 2011 18:17:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.ahsoftware.de X-Spam-Level: X-Spam-Status: No, score=-101.0 required=5.0 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=disabled version=3.3.1 Received: from eiche.ahsoftware (p57B21769.dip0.t-ipconnect.de [87.178.23.105]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id 8D60B434618 for ; Thu, 16 Jun 2011 18:17:39 +0200 (CEST) Received: by eiche.ahsoftware (Postfix, from userid 65534) id A344F3FD37; Thu, 16 Jun 2011 18:17:38 +0200 (CEST) Received: from krabat.ahsoftware (unknown [192.168.207.2]) by eiche.ahsoftware (Postfix) with ESMTP id 6F6A73FD2A; Thu, 16 Jun 2011 16:17:17 +0000 (UTC) From: Alexander Holler To: gregkh@suse.de Subject: [PATCH] USB: ehci: use packed, aligned(4) instead of removing the packed attribute Date: Thu, 16 Jun 2011 18:17:10 +0200 Message-Id: <1308241030-15201-1-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1303918648-7196-1-git-send-email-rabin@rab.in> References: <1303918648-7196-1-git-send-email-rabin@rab.in> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110616_121746_836657_F267D2FC X-CRM114-Status: GOOD ( 14.96 ) 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 ---- ---------------------- -------------------------------------------------- Cc: Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Rabin Vincent , 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: , MIME-Version: 1.0 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 (demeter2.kernel.org [140.211.167.43]); Thu, 16 Jun 2011 16:18:26 +0000 (UTC) In commit 139540170d9d9b7ead3caaf540f161756b356d56 the attribute packed is removed from the structs which are used to access the EHCI-registers. This is done to circumvent a problem with gcc 4.6, which might access members of packed structs on a byte by byte basis. But using packed, aligned(4) fixes that too and is imho the better solution. Otherwise (without packed) the compiler would be free to choose whatever alignment he thinks fits best, which might be e.g. 8-byte on 64-bit machines. Signed-off-by: Alexander Holler Reviewed-by: Nicolas Pitre --- include/linux/usb/ehci_def.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index 7cc95ee..15c87a9 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h @@ -57,7 +57,7 @@ struct ehci_caps { #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ u8 portroute[8]; /* nibbles for routing - offset 0xC */ -}; +} __attribute__ ((packed, aligned(4))); /* Section 2.3 Host Controller Operational Registers */ @@ -155,7 +155,7 @@ struct ehci_regs { #define PORT_CSC (1<<1) /* connect status change */ #define PORT_CONNECT (1<<0) /* device connected */ #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) -}; +} __attribute__ ((packed, aligned(4))); #define USBMODE 0x68 /* USB Device mode */ #define USBMODE_SDIS (1<<3) /* Stream disable */ @@ -199,7 +199,7 @@ struct ehci_dbg_port { u32 data47; u32 address; #define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) -}; +} __attribute__ ((packed, aligned(4))); #ifdef CONFIG_EARLY_PRINTK_DBGP #include