Re: [PATCH 3/3] iio: common: st_sensors: fix includes with IWYU

Jonathan Cameron
2026-04-27T10:11:08Z

On Sun, 26 Apr 2026 18:18:02 -0300
Caio Morais <caiomorais@usp.br> wrote:

> From: Caio Morais <caiomorais@usp.br>
>
> Signed-off-by: Caio Morais <caiomorais@usp.br>
> ---
> drivers/iio/common/st_sensors/st_sensors_i2c.c | 7 +++++--
> drivers/iio/common/st_sensors/st_sensors_spi.c | 9 +++++++--
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> index 7156302fe..04d106def 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> @@ -7,12 +7,15 @@
> * Denis Ciocca <denis.ciocca@st.com>
> */
>
> +#include <linux/device.h>
> +#include <linux/err.h>
> #include <linux/i2c.h>
> -#include <linux/kernel.h>
> +#include <linux/linkage.h>
> #include <linux/module.h>
> -#include <linux/iio/iio.h>
> #include <linux/regmap.h>
>
> +#include <linux/iio/iio.h>
> +
> #include <linux/iio/common/st_sensors_i2c.h>
>
> #define ST_SENSORS_I2C_MULTIREAD 0x80
> diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
> index 0da270139..884077d51 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_spi.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
> @@ -7,12 +7,17 @@
> * Denis Ciocca <denis.ciocca@st.com>
> */
>
> -#include <linux/kernel.h>
> +#include <linux/device.h>
This one is similar to kernel.h in that it's mostly a catch all header
that we prefer to replace if possible with more specific ones.

Now the driver might directly dereference a struct device, but if
so that normally indicates something we should clean up.
Maybe it's something else. As mentioned in previous review
providing that info under the --- in the patch can save time on
questions like this.

> +#include <linux/err.h>
> +#include <linux/linkage.h>
> #include <linux/module.h>
> -#include <linux/iio/iio.h>
> #include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/spi/spi.h>
> +#include <linux/stddef.h>
> +#include <linux/types.h>
> +
> +#include <linux/iio/iio.h>
>
> #include <linux/iio/common/st_sensors_spi.h>
>