Re: [PATCH 2/4] iio: imu: add Bosch Sensortec BNO055 core driver

Andy Shevchenko
2021-08-04T19:28:21Z

On Wed, Aug 4, 2021 at 7:51 PM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:
> On Wed, 4 Aug 2021 12:06:46 +0200
> Andrea Merello <andrea.merello@gmail.com> wrote:
> > Il giorno sab 31 lug 2021 alle ore 19:58 Jonathan Cameron
> > <jic23@kernel.org> ha scritto:

...

> > Isn't this like doing a cut-and-paste of check+dev_err() in more than
> > a dozen places in the code?
> >
> > If you just want more information about the caller then we could
> > macroize those functions, so they can also print the caller code line
> > number (or they could accept an additional argument, which is the code
> > line number to print, and then a macro helper that adds that last
> > argument can be used to invoke them).. But this wouldn't address your
> > second point..
> It's a trade off between reviewability which these wrappers make worse
> and short code.
>
> My personal preference is don't bother with messages on simple reg read /write
> failures. If it happens you either get an error reported to userspace and
> can do some more debug, or the driver doesn't probe - again, more debug to
> be done even if you know it was a read or write.

The advantage of regmap is that it has already established trace
events. No need to add additional stuff (at least it's easy to see,
read or write or what values were there). I personally put messages on
regmap reads and writes in the specific cases only, when it indeed may
shed a light on some events.

--
With Best Regards,
Andy Shevchenko