[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeRpEgpFe2J0epjJQsBS346B+vDJ+74fFumFCN2Sy6FCA@mail.gmail.com>
Date: Sat, 1 May 2021 21:51:15 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Ivan Mikhaylov <i.mikhaylov@...ro.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
linux-hwmon@...r.kernel.org
Subject: Re: [PATCH 2/4] iio: proximity: vcnl3020: add threshold options
On Fri, Apr 30, 2021 at 6:16 PM Ivan Mikhaylov <i.mikhaylov@...ro.com> wrote:
>
> Add the low/high threshold options.
...
> + rc = regmap_bulk_read(data->regmap, VCNL_PS_HI_THR_HI,
> + &res, 2);
sizeof(res)
> + *val = be16_to_cpu(res);
So, the rule of thumb is not putting anything to the output, until you
know that there is no error.
> + if (rc < 0)
> + return rc;
...
> + rc = regmap_bulk_read(data->regmap, VCNL_PS_LO_THR_HI,
> + &res, 2);
> + *val = be16_to_cpu(res);
> + if (rc < 0)
> + return rc;
As per above.
...
> + rc = regmap_bulk_write(data->regmap, VCNL_PS_HI_THR_HI,
> + &buf, 2);
sizeof(buf) ?
...
> + rc = regmap_bulk_write(data->regmap, VCNL_PS_LO_THR_HI,
> + &buf, 2);
Ditto.
...
> +end:
out_release_direct_mode:
> + iio_device_release_direct_mode(indio_dev);
> + return rc;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists