RE: [PATCH v5 2/4] iio: adc: ad4691: add initial driver for AD4691 family

From: Sabau, Radu bogdan

Date: Tue Mar 31 2026 - 13:13:45 EST




> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Sent: Tuesday, March 31, 2026 11:59 AM
> To: Sabau, Radu bogdan <Radu.Sabau@xxxxxxxxxx>
> Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>; Lars-Peter Clausen
> <lars@xxxxxxxxxx>; Hennerich, Michael <Michael.Hennerich@xxxxxxxxxx>;
> Jonathan Cameron <jic23@xxxxxxxxxx>; David Lechner
> <dlechner@xxxxxxxxxxxx>; Sa, Nuno <Nuno.Sa@xxxxxxxxxx>; Andy
> Shevchenko <andy@xxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>; Krzysztof
> Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley <conor+dt@xxxxxxxxxx>; Uwe
> Kleine-König <ukleinek@xxxxxxxxxx>; Liam Girdwood <lgirdwood@xxxxxxxxx>;
> Mark Brown <broonie@xxxxxxxxxx>; Linus Walleij <linusw@xxxxxxxxxx>;
> Bartosz Golaszewski <brgl@xxxxxxxxxx>; Philipp Zabel
> <p.zabel@xxxxxxxxxxxxxx>; Jonathan Corbet <corbet@xxxxxxx>; Shuah Khan
> <skhan@xxxxxxxxxxxxxxxxxxx>; linux-iio@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> pwm@xxxxxxxxxxxxxxx; linux-gpio@xxxxxxxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v5 2/4] iio: adc: ad4691: add initial driver for AD4691
> family
>
> [External]
>
> On Tue, Mar 31, 2026 at 08:36:42AM +0000, Sabau, Radu bogdan wrote:
> > > -----Original Message-----
> > > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> > > Sent: Monday, March 30, 2026 8:24 PM
>
> ...
>
> > > > > > +#include <linux/bitfield.h>
> > > > > > +#include <linux/bitops.h>
> > > > > > +#include <linux/cleanup.h>
> > > > > > +#include <linux/delay.h>
> > > > > > +#include <linux/device.h>
> > > > >
> > > > > Hmm... Is it used? Or perhaps you need only
> > > > > dev_printk.h
> > > > > device/devres.h
> > > > > ?
> > >
> > > > I have checked this out and it seems device.h doesn't actually need
> > > > to be included anyway since spi.h directly includes device.h, and since
> > > > this is a SPI driver that's never going away, it's covered. Will drop it!
> > >
> > > No, this is the wrong justification. IWYU principle is about exact
> > > match between what is used and included in a file (module). spi.h is
> > > not dev_*() provider and may not be considered for that.
> > >
> >
> > You are right, my justification was incorrect. Under IWYU, relying on
> > spi.h's transitive pull of device.h is not valid. However, I think device.h
> > is still needed in this case since struct device is used directly in the code
> > both as local variables and in the regmap callbacks.
>
> Really? I can't see that.
> (Hint: use of the data type and use of its pointer is a huge difference.)
>
> > Also dev_err_probe() is called directly and lives in device.h.
>
> No, as I started with my replies. The proper header that provides it is
> dev_printk.h.
>

Yep, my bad... device.h can be removed and devres and dev_printk be
used instead. Sorry for the confusion from my end, I thought I was
looking at device.h, but was instead looking at dev_printk.h.