Re: [PATCH v2 5/8] rtc: isl12022: implement RTC_VL_READ ioctl

From: Andy Shevchenko
Date: Wed Jun 14 2023 - 08:16:37 EST


On Tue, Jun 13, 2023 at 11:26:51PM +0200, Alexandre Belloni wrote:
> On 13/06/2023 18:20:56+0300, Andy Shevchenko wrote:
> > On Tue, Jun 13, 2023 at 03:00:07PM +0200, Rasmus Villemoes wrote:

...

> > > + ret = regmap_read(regmap, ISL12022_REG_SR, &val);
> > > + if (ret < 0)
> >
> > I always feel uneasy with ' < 0' — Does positive error makes sense?
> > Is it even possible? OTOH if the entire driver uses this idiom...
> > oh well, let's make it consistent.
>
> /**
> * regmap_read() - Read a value from a single register
> *
> * @map: Register map to read from
> * @reg: Register to be read from
> * @val: Pointer to store read value
> *
> * A value of zero will be returned on success, a negative errno will
> * be returned in error cases.
> */

I'm not sure what you meant by this. Yes, I know that there is no
possibility that regmap API returns positive value. Do you mean that
regmap API documentation is unclear?

> > > + return ret;

--
With Best Regards,
Andy Shevchenko