[PATCH] iio: accel: stk8ba50: Update includes to match IWYU

Miao Li posted 1 patch 5 days, 3 hours ago
drivers/iio/accel/stk8ba50.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
[PATCH] iio: accel: stk8ba50: Update includes to match IWYU
Posted by Miao Li 5 days, 3 hours ago
From: Miao Li <limiao@kylinos.cn>

Update the list of included headers in stk8ba50.c using
Include-What-You-Use (IWYU) tool, mainly to remove kernel.h
and add missing headers such as array_size.h, bits.h,
dev_printk.h, etc.

Signed-off-by: Miao Li <limiao@kylinos.cn>
---
 drivers/iio/accel/stk8ba50.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index a9ff2a273fe1..c40fb2a466fb 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -7,11 +7,17 @@
  * STK8BA50 7-bit I2C address: 0x18.
  */
 
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/dev_printk.h>
+#include <linux/errno.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
+#include <linux/pm.h>
+#include <linux/sysfs.h>
 #include <linux/types.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
@@ -19,6 +25,7 @@
 #include <linux/iio/trigger.h>
 #include <linux/iio/triggered_buffer.h>
 #include <linux/iio/trigger_consumer.h>
+#include <linux/iio/types.h>
 
 #define STK8BA50_REG_XOUT			0x02
 #define STK8BA50_REG_YOUT			0x04
-- 
2.25.1
Re: [PATCH] iio: accel: stk8ba50: Update includes to match IWYU
Posted by Andy Shevchenko 4 days, 23 hours ago
On Wed, Jun 03, 2026 at 09:50:33AM +0800, Miao Li wrote:

> Update the list of included headers in stk8ba50.c using
> Include-What-You-Use (IWYU) tool, mainly to remove kernel.h
> and add missing headers such as array_size.h, bits.h,
> dev_printk.h, etc.

...

> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> +#include <linux/dev_printk.h>
> +#include <linux/errno.h>
>  #include <linux/i2c.h>
>  #include <linux/interrupt.h>
> -#include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/mutex.h>
> +#include <linux/pm.h>
> +#include <linux/sysfs.h>
>  #include <linux/types.h>

While at it, add a blank line here.

>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>

...

> +#include <linux/iio/types.h>

Not sure if we need this one to be explicitly added when iio.h is included.


-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] iio: accel: stk8ba50: Update includes to match IWYU
Posted by Waqar Hameed 4 days, 21 hours ago
On Wed, Jun 03, 2026 at 08:52 +0300 Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

[...]

>> +#include <linux/iio/types.h>
>
> Not sure if we need this one to be explicitly added when iio.h is included.

I would vote for removing this, to be consistent with most other drivers.
Re: [PATCH] iio: accel: stk8ba50: Update includes to match IWYU
Posted by Jonathan Cameron 4 days, 18 hours ago
On Wed, 3 Jun 2026 09:47:06 +0200
Waqar Hameed <waqar.hameed@axis.com> wrote:

> On Wed, Jun 03, 2026 at 08:52 +0300 Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> 
> [...]
> 
> >> +#include <linux/iio/types.h>  
> >
> > Not sure if we need this one to be explicitly added when iio.h is included.  
> 
> I would vote for removing this, to be consistent with most other drivers.

I've merged changes recently where some included this and some didn't.
I agree that we can assume iio.h will always include it so probably better
to drop it from these sorts of change. I don't want to see lots of patches dropping
from existing drivers though as that's just too much churn.

Jonathan