lkml.org 
[lkml]   [2021]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110
On Thu, Aug 12, 2021 at 10:23:41PM +0530, Mugilraj Dhavachelvan wrote:
> On Wed, Aug 11, 2021 at 07:06:43PM +0300, Andy Shevchenko wrote:
> > On Wed, Aug 11, 2021 at 11:15 AM Lars-Peter Clausen <lars@metafoo.de> wrote:
> > > On 8/10/21 2:49 PM, Andy Shevchenko wrote:
> > > >
> > > >> + 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.
> >
> > Good catch!
> > I'm wondering if it's a good idea to have a sign_magnitude_to_int()
> > helper or so?
> >
> So, What should I do now?
>
Will send v3 with other changes and add this change in v4. Hope it's
okay.
> > --
> > With Best Regards,
> > Andy Shevchenko

\
 
 \ /
  Last update: 2021-08-14 10:18    [W:0.073 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site