public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mateusz Zalega <m.zalega@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] exynos: ehci: added missing 'packed' attribute
Date: Wed, 21 Aug 2013 18:45:21 +0200	[thread overview]
Message-ID: <5214EEA1.4030403@samsung.com> (raw)
In-Reply-To: <1377086283-727-1-git-send-email-m.zalega@samsung.com>

On 08/21/13 13:58, Mateusz Zalega wrote:
> Structure exynos_usb_phy lacked __attribute__ ((packed)), which might
> have led to broken EHCI functionality in builds based on more recent
> compilers.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
> Changes since v1:
> - changed linux/compiler-gcc.h to linux/compiler.h
> 
> ---
>  arch/arm/include/asm/arch-exynos/ehci.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-exynos/ehci.h b/arch/arm/include/asm/arch-exynos/ehci.h
> index d79f25c..c965b2c 100644
> --- a/arch/arm/include/asm/arch-exynos/ehci.h
> +++ b/arch/arm/include/asm/arch-exynos/ehci.h
> @@ -9,6 +9,7 @@
>  
>  #ifndef __ASM_ARM_ARCH_EHCI_H__
>  #define __ASM_ARM_ARCH_EHCI_H__
> +#include <linux/compiler.h>
>  
>  #define CLK_24MHZ		5
>  
> @@ -45,7 +46,7 @@ struct exynos_usb_phy {
>  	unsigned int usbotgsys;
>  	unsigned int reserved4;
>  	unsigned int usbotgtune;
> -};
> +} __packed;
>  
>  /* Switch on the VBUS power. */
>  int board_usb_vbus_init(void);
> 

I may have reacted too fast.

I assumed that we should keep __packed attribute here, because we're
referring to platform register and we'd better underline our need to
keep compiler from tampering with our layout.

It turned out this code will work just fine, because ARM ABI mandates
correct layout of structure members in such cases:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/Babjddhe.html

It wouldn't work if there were any bitfields or unaligned members in
Exynos register structures, but after more careful examination I can
tell there are none.

Regards,

-- 
Mateusz Zalega
Samsung R&D Institute Poland

      reply	other threads:[~2013-08-21 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 11:30 [U-Boot] [PATCH] exynos: ehci: added missing 'packed' attribute Mateusz Zalega
2013-08-21 11:58 ` [U-Boot] [PATCH v2] " Mateusz Zalega
2013-08-21 16:45   ` Mateusz Zalega [this message]

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=5214EEA1.4030403@samsung.com \
    --to=m.zalega@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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