lkml.org 
[lkml]   [2022]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 05/10] iio: accel: bma400: Add separate channel for step counter
On Thu,  5 May 2022 19:00:16 +0530
Jagath Jog J <jagathjog1996@gmail.com> wrote:

> Added channel for step counter which can be enable or disable
> through the sysfs interface.
>
> Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com>
> ---
>
> +static int bma400_enable_steps(struct bma400_data *data, int val)
> +{
> + int ret;
> +
> + if (data->steps_enabled == val)
> + return 0;
> +
> + ret = regmap_update_bits(data->regmap, BMA400_INT_CONFIG1_REG,
> + BMA400_STEP_INT_MSK,
> + FIELD_PREP(BMA400_STEP_INT_MSK, !!val));
This gives a dubious x & !y warning

So I've changed it to val ? 1 : 0

Jonathan

> + if (ret)
> + return ret;
> + data->steps_enabled = val;
> + return ret;
> +}

\
 
 \ /
  Last update: 2022-05-07 18:01    [W:0.107 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site