RE: [PATCH v5 2/4] iio: adc: ad4691: add initial driver for AD4691 family
From: Sabau, Radu bogdan
Date: Tue Mar 31 2026 - 04:41:24 EST
> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> Sent: Monday, March 30, 2026 8:24 PM
> To: Sabau, Radu bogdan <Radu.Sabau@xxxxxxxxxx>
>
> ...
>
> > > > +#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. Also dev_err_probe()
is called directly and lives in device.h.
What's your take on this?
Best Regards,
Radu