diff options
| author | Javier Martinez Canillas <javier.martinez@collabora.co.uk> | 2015-02-02 06:26:22 -0500 |
|---|---|---|
| committer | Olof Johansson <olof@lixom.net> | 2015-02-26 18:44:52 -0500 |
| commit | 1b84f2a4cd4a6f517a313261f6f7c8caae5696c6 (patch) | |
| tree | 8e7b0f5a1477c8792a83c7de0b03b8dc0ad737a1 /drivers/input | |
| parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) | |
mfd: cros_ec: Use fixed size arrays to transfer data with the EC
The struct cros_ec_command will be used as an ioctl() argument for the
API to control the ChromeOS EC from user-space. So the data structure
has to be 64-bit safe to make it compatible between 32 and 64 avoiding
the need for a compat ioctl interface. Since pointers are self-aligned
to different byte boundaries, use fixed size arrays instead of pointers
for transferring ingoing and outgoing data with the Embedded Controller.
Also, re-arrange struct members by decreasing alignment requirements to
reduce the needing padding size.
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Acked-by: Lee Jones <lee.jones@linaro.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/keyboard/cros_ec_keyb.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index ffa989f2c785..769f8f7f62b7 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c | |||
| @@ -148,16 +148,19 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev, | |||
| 148 | 148 | ||
| 149 | static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) | 149 | static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) |
| 150 | { | 150 | { |
| 151 | int ret; | ||
| 151 | struct cros_ec_command msg = { | 152 | struct cros_ec_command msg = { |
| 152 | .version = 0, | ||
| 153 | .command = EC_CMD_MKBP_STATE, | 153 | .command = EC_CMD_MKBP_STATE, |
| 154 | .outdata = NULL, | ||
| 155 | .outsize = 0, | ||
| 156 | .indata = kb_state, | ||
| 157 | .insize = ckdev->cols, | 154 | .insize = ckdev->cols, |
| 158 | }; | 155 | }; |
| 159 | 156 | ||
| 160 | return cros_ec_cmd_xfer(ckdev->ec, &msg); | 157 | ret = cros_ec_cmd_xfer(ckdev->ec, &msg); |
| 158 | if (ret < 0) | ||
| 159 | return ret; | ||
| 160 | |||
| 161 | memcpy(kb_state, msg.indata, ckdev->cols); | ||
| 162 | |||
| 163 | return 0; | ||
| 161 | } | 164 | } |
| 162 | 165 | ||
| 163 | static irqreturn_t cros_ec_keyb_irq(int irq, void *data) | 166 | static irqreturn_t cros_ec_keyb_irq(int irq, void *data) |
