lkml.org 
[lkml]   [2020]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 08/15] iio: sx9310: Use regmap_read_poll_timeout() for compensation
From
Date
Quoting Daniel Campello (2020-07-28 08:12:51)
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index 2465064971d0a7..3956fd679c6db9 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -810,22 +810,17 @@ static int sx9310_init_compensation(struct iio_dev *indio_dev)
> if (ret < 0)
> return ret;
>
> - for (i = 100; i >= 0; i--) {
> - msleep(20);
> - ret = regmap_read(data->regmap, SX9310_REG_STAT1, &val);
> - if (ret < 0)
> - goto out;
> - if (!(val & SX9310_COMPSTAT_MASK))
> - break;
> - }
> -
> - if (i < 0) {
> - dev_err(&data->client->dev,
> - "initial compensation timed out: 0x%02x", val);
> - ret = -ETIMEDOUT;
> + ret = regmap_read_poll_timeout(data->regmap, SX9310_REG_STAT1, val,
> + !(val & SX9310_REG_STAT1_COMPSTAT_MASK),
> + 20000, 2000000);
> + if (ret) {
> + if (ret == -ETIMEDOUT)
> + dev_err(&data->client->dev,
> + "0x02 << 3l compensation timed out: 0x%02x",

What does 0x02 << 3l mean?

> + val);
> + return ret;
> }
>

\
 
 \ /
  Last update: 2020-07-28 21:39    [W:0.679 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site