Re: [PATCH v4 5/7] iio: light: vcnl4000: Add period for vcnl4040/4200

From: andy . shevchenko
Date: Mon May 29 2023 - 01:20:22 EST


Mon, May 22, 2023 at 04:26:19PM +0200, Astrid Rost kirjoitti:
> Add read/write attribute for proximity and illuminance period.
> The period is set in the interrupt persistence flags
> (PS_PERS and ALS_PERS). An interrupt will not be asserted if the raw
> value is not over (or lower) than the threshold for the set
> continued amount of measurements.
> The time in seconds is calculated by the number of continued refreshes
> multiplied with the integration time.
> It will always pick the next lower possible value. The period changes,
> if the integration time is changed.

Something interesting happened to the indentation in the above text.

...

> +out:

out_unlock:

> + mutex_unlock(&data->vcnl4000_lock);
> + return ret;

...

> + *val2 = (*data->chip_spec->ps_it_times)[ret_it][1]
> + * vcnl4040_ps_persistence[ret_pers];

' *' can be placed on the previous line.

...

> + if (val2 <= vcnl4040_ps_persistence[index]
> + * (*data->chip_spec->ps_it_times)[ret_it][1])

Ditto.

> + break;

...

> +out:

out_unlock:

> + mutex_unlock(&data->vcnl4000_lock);
> + return ret;

...

> + case IIO_EV_DIR_RISING:
> + ret = i2c_smbus_write_word_data(
> + data->client, VCNL4040_ALS_THDH_LM, val);

Indentation.

> + break;
> + case IIO_EV_DIR_FALLING:
> + ret = i2c_smbus_write_word_data(
> + data->client, VCNL4040_ALS_THDL_LM, val);

Ditto.

> + break;

...

> + case IIO_EV_DIR_RISING:
> + ret = i2c_smbus_write_word_data(
> + data->client, VCNL4040_PS_THDH_LM, val);
> + break;
> + case IIO_EV_DIR_FALLING:
> + ret = i2c_smbus_write_word_data(
> + data->client, VCNL4040_PS_THDL_LM, val);
> + break;

Ditto.

...

> + {
> + .type = IIO_EV_TYPE_THRESH,
> + .dir = IIO_EV_DIR_RISING,
> + .mask_separate = BIT(IIO_EV_INFO_VALUE),
> + }, {
> + .type = IIO_EV_TYPE_THRESH,
> + .dir = IIO_EV_DIR_FALLING,
> + .mask_separate = BIT(IIO_EV_INFO_VALUE),
> + }, {
> + .type = IIO_EV_TYPE_THRESH,
> + .dir = IIO_EV_DIR_EITHER,
> + .mask_separate = BIT(IIO_EV_INFO_ENABLE) | BIT(IIO_EV_INFO_PERIOD),
> + }

Can we keep trailing comma here?

...

> - },

Stray change (and see just above).

> + }, {
> + .type = IIO_EV_TYPE_THRESH,
> + .dir = IIO_EV_DIR_EITHER,
> + .mask_separate = BIT(IIO_EV_INFO_PERIOD),
> + }

--
With Best Regards,
Andy Shevchenko