Re: [PATCH v3 6/6] iio: adc: ad4851: add ad485x driver

From: Andy Shevchenko
Date: Tue Oct 15 2024 - 07:14:06 EST


On Mon, Oct 14, 2024 at 05:08:47PM -0500, David Lechner wrote:
> On 10/14/24 8:14 AM, Andy Shevchenko wrote:
> > On Mon, Oct 14, 2024 at 12:40:40PM +0300, Antoniu Miclaus wrote:

...

> >> + return regmap_update_bits(st->regmap, AD4851_REG_PACKET,
> >> + AD4851_PACKET_FORMAT_MASK, (osr == 1) ? 0 : 1);
> >
> > I would do it with a conditional
> >
> > if (osr ...)
> > return regmap_update_bits(st->regmap, AD4851_REG_PACKET,
> > AD4851_PACKET_FORMAT_MASK, 0);
> >
> > return regmap_update_bits(st->regmap, AD4851_REG_PACKET,
> > AD4851_PACKET_FORMAT_MASK, 1);
> >
> If we do this, regmap_set_bits() and regmap_clear_bits() would
> be even better.

Sure, but I want also to have the only one conditional, so the respective
helper functions can be easily read and followed.

--
With Best Regards,
Andy Shevchenko