Thread (18 messages) 18 messages, 6 authors, 2021-05-17

Re: [PATCH 2/4] iio: proximity: vcnl3020: add threshold options

From: Andy Shevchenko <hidden>
Date: 2021-05-01 18:51:38
Also in: linux-hwmon, lkml

On Fri, Apr 30, 2021 at 6:16 PM Ivan Mikhaylov [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help