linux-stable/drivers/platform/chrome
Javier Martinez Canillas a841178445 mfd: cros_ec: Use a zero-length array for command data
Commit 1b84f2a4cd ("mfd: cros_ec: Use fixed size arrays to transfer
data with the EC") modified the struct cros_ec_command fields to not
use pointers for the input and output buffers and use fixed length
arrays instead.

This change was made because the cros_ec ioctl API uses that struct
cros_ec_command to allow user-space to send commands to the EC and
to get data from the EC. So using pointers made the API not 64-bit
safe. Unfortunately this approach was not flexible enough for all
the use-cases since there may be a need to send larger commands
on newer versions of the EC command protocol.

So to avoid to choose a constant length that it may be too big for
most commands and thus wasting memory and CPU cycles on copy from
and to user-space or having a size that is too small for some big
commands, use a zero-length array that is both 64-bit safe and
flexible. The same buffer is used for both output and input data
so the maximum of these values should be used to allocate it.

Suggested-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:19 +01:00
..
chromeos_laptop.c platform/chrome: chromeos_laptop - instantiate Atmel at primary address 2015-04-24 22:07:14 -07:00
chromeos_pstore.c platform/chrome: pstore: fix dmi table to match all chrome systems 2014-07-10 10:38:41 -07:00
cros_ec_dev.c mfd: cros_ec: Use a zero-length array for command data 2015-06-15 13:18:19 +01:00
cros_ec_dev.h platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00
cros_ec_lightbar.c mfd: cros_ec: Use a zero-length array for command data 2015-06-15 13:18:19 +01:00
cros_ec_lpc.c mfd: cros_ec: Use a zero-length array for command data 2015-06-15 13:18:19 +01:00
cros_ec_sysfs.c mfd: cros_ec: Use a zero-length array for command data 2015-06-15 13:18:19 +01:00
Kconfig platform/chrome: cros_ec_lpc - Depend on X86 || COMPILE_TEST 2015-03-04 11:29:45 -08:00
Makefile platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00