Thread (14 messages) 14 messages, 5 authors, 2021-08-14

Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110

From: Lars-Peter Clausen <lars@metafoo.de>
Date: 2021-08-11 08:15:34
Also in: linux-devicetree, lkml

On 8/10/21 2:49 PM, Andy Shevchenko wrote:
quoted
+       data->tol = data->cfg->kohms * (val & GENMASK(6, 0)) * 10 / 8;
+       if (!(val & BIT(7)))
+               data->tol *= -1;
Shouldn't you simple use corresponding sign_extend*()?
The data is encoded a sign-magnitude. sign_extend() works for two's 
complement numbers.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help