Re: [PATCH 1/2] iio: cros_ec: Add sign vector in core for backward compatibility

From: Doug Anderson
Date: Thu Jun 20 2019 - 17:46:56 EST


Hi,

On Thu, Jun 20, 2019 at 11:53 AM Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote:
>
> To allow cros_ec iio core library to be used with legacy device, add a
> vector to rotate sensor data if necessary: legacy devices are not
> reporting data in HTML5/Android sensor referential.
>
> TEST=On veyron minnie, check chrome detect tablet mode and rotate
> screen in tablet mode.

TEST= doesn't belong in an upstream patch.


> Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
> ---
> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 5 ++++-
> include/linux/iio/common/cros_ec_sensors_core.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index 719a0df5aeeb..1b2e7a8242ad 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -66,8 +66,10 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
> }
> state->type = state->resp->info.type;
> state->loc = state->resp->info.location;
> - }
>
> + /* Set sign vector, only used for backward compatibility. */
> + memset(state->sign, 1, CROS_EC_SENSOR_MAX_AXIS);
> + }
> return 0;

Normally there's a blank line before the "return". There was before
your patch. Why did you remove it? It'll make your diff cleaner if
you keep it.

Also, should you be basing your patch atop +Fabien's series? I notice
you got a conflict when you picked this into the Chrome OS tree, but
maybe you wouldn't have if you had based atop
<https://lore.kernel.org/patchwork/patch/1090463/> AKA
<https://lkml.kernel.org/r/ac3cdc104e59565d178dfa86f2727045224dc4da.1560848479.git.fabien.lahoudere@xxxxxxxxxxxxx>


-Doug