[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4CgPhhk0t7BM5JY@smile.fi.intel.com>
Date: Fri, 25 Nov 2022 13:00:14 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Gerald Loacker <gerald.loacker@...fvision.net>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jakob Hauser <jahau@...ketmail.com>,
Linus Walleij <linus.walleij@...aro.org>,
Nikita Yushchenko <nikita.yoush@...entembedded.com>,
Michael Riesch <michael.riesch@...fvision.net>
Subject: Re: [PATCH v3 3/3] iio: magnetometer: add ti tmag5273 driver
On Fri, Nov 25, 2022 at 12:59:01PM +0200, Andy Shevchenko wrote:
> On Fri, Nov 25, 2022 at 09:35:26AM +0100, Gerald Loacker wrote:
...
> > +static int tmag5273_write_scale(struct tmag5273_data *data, int scale_micro)
> > +{
>
> What about
>
> u32 mask;
After looking again, I guess it should be
u32 value;
> > + int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(tmag5273_scale[0]); i++) {
> > + if (tmag5273_scale[data->version][i].val_micro == scale_micro)
> > + break;
> > + }
> > + if (i == ARRAY_SIZE(tmag5273_scale[0]))
> > + return -EINVAL;
> > + data->scale_index = i;
>
> if (data->scale_index == MAGN_RANGE_LOW)
> mask = 0;
> else
> mask = TMAG5273_Z_RANGE_MASK | TMAG5273_X_Y_RANGE_MASK;
>
> > + return regmap_update_bits(data->map,
> > + TMAG5273_SENSOR_CONFIG_2,
> > + TMAG5273_Z_RANGE_MASK | TMAG5273_X_Y_RANGE_MASK,
>
> mask);
>
> > + data->scale_index == MAGN_RANGE_LOW ? 0 :
> > + TMAG5273_Z_RANGE_MASK |
> > + TMAG5273_X_Y_RANGE_MASK);
>
> ?
>
> > +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists