Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1476148 > unrolled thread

Re: [PATCH] pwm: cros_ec: add __packed to prevent padding

Started byThierry Reding <thierry.reding@gmail.com>
First post2016-09-05 08:50 +0200
Last post2016-09-05 08:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] pwm: cros_ec: add __packed to prevent padding Thierry Reding <thierry.reding@gmail.com> - 2016-09-05 08:50 +0200

#1476148 — Re: [PATCH] pwm: cros_ec: add __packed to prevent padding

FromThierry Reding <thierry.reding@gmail.com>
Date2016-09-05 08:50 +0200
SubjectRe: [PATCH] pwm: cros_ec: add __packed to prevent padding
Message-ID<sdVTb-6R-5@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Tue, Jul 26, 2016 at 11:22:13AM -0700, Brian Norris wrote:
> While the particular usage in question is likely safe (struct
> cros_ec_command is 32-bit aligned, followed by <=32-bit fields), it's
> been suggested this is not a great pattern to follow for the general
> case -- for example, if we follow a 'struct cros_ec_command' (which is
> 32-bit- but not 64-bit-aligned) with a struct that starts with a 64-bit
> type (e.g., u64), the compiler may add padding.
> 
> Let's add __packed, to inform the compiler of our true intention -- to
> have no padding between these struct elements -- and to future proof for
> any refactorings that might occur.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> Hi Thierry,
> 
> I don't know of any bugs directly resolved by this patch, so take it for
> v4.8/v4.9 at your discretion.
> 
>  drivers/pwm/pwm-cros-ec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web