UPSTREAM: pwm: cros-ec: Add __packed to prevent padding
authorBrian Norris <briannorris@chromium.org>
Tue, 26 Jul 2016 18:22:13 +0000 (11:22 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit22f81326b558780967a0046e77256b34ae06e384
tree8b08291ba8e309166ddfc5b12011f35b847564d7
parent155c86c803c69b4d412ad96cc8f2e59e14696369
UPSTREAM: pwm: cros-ec: Add __packed to prevent padding

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>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 065cfbbb638cce3d388020c4b97813b4a904a7c3)

Change-Id: Iddd499863dde168679a88c2f9ecc461316b417a0
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/pwm/pwm-cros-ec.c