Skip to contentSkip to conversation

iio: frequency: ad9834: clean up includes

PATCH In review Joshua Crofts 3 participants 6 messages Apr 16 – Apr 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 iio: frequency: ad9834: clean up includes

Cleanup include headers by removing proxy kernel.h header and unnecessary list.h, interrupt.h, workqueue.h and slab.h headers. Added additional headers that were previously included from kernel.h.

Verified using the include-what-you-use tool.

---
 drivers/staging/iio/frequency/ad9834.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/staging/iio/frequency/ad9834.c +12 -9
index d339d5e8e0..9b65fbe1c7 100644
@@ -5,18 +5,21 @@
  * Copyright 2010-2011 Analog Devices Inc.
  */
 
+#include <linux/bits.h>
 #include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/workqueue.h>
-#include <linux/device.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/sysfs.h>
-#include <linux/list.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/consumer.h>
+#include <linux/dev_printk.h>
 #include <linux/err.h>
+#include <linux/kstrtox.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
+#include <asm/byteorder.h>
 #include <asm/div64.h>
 
 #include <linux/iio/iio.h>
Signature · 1 line
2.47.3
#1 lore raw
Quoted 5 lines · Joshua Crofts

Cleanup include headers by removing proxy kernel.h header and unnecessary list.h, interrupt.h, workqueue.h and slab.h headers. Added additional headers that were previously included from kernel.h.

Verified using the include-what-you-use tool.

I'm wondering why in previous round the tool haven't noticed what I did...

...

Quoted 11 lines
drivers/staging/iio/frequency/ad9834.c +1 -9
+#include <linux/bits.h>
 #include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/workqueue.h>
-#include <linux/device.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/sysfs.h>
-#include <linux/list.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/consumer.h>

drivers/staging/iio/frequency/ad9834.c

Quoted 10 lines
drivers/staging/iio/frequency/ad9834.c +7 -0
+#include <linux/dev_printk.h>
 #include <linux/err.h>
+#include <linux/kstrtox.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
 
+#include <linux/string.h>

Hmm... What's used for here?

Quoted 5 lines
drivers/staging/iio/frequency/ad9834.c +4 -0
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
+#include <asm/byteorder.h>
 #include <asm/div64.h>
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 1 line · Andy Shevchenko

I'm wondering why in previous round the tool haven't noticed what I did...

Yeah, the tool is pretty noisy unfortunately, even with tweaking it's not exactly 100%.

Quoted 3 lines
Quoted 1 line

+#include <linux/string.h>

Hmm... What's used for here?

sysfs_streq() is defined in linux/string.h.

Signature · 3 lines
Kind regards

CJD
#3 lore raw
Quoted 6 lines · Joshua Crofts
Quoted 1 line · Andy Shevchenko

I'm wondering why in previous round the tool haven't noticed what I did...

Yeah, the tool is pretty noisy unfortunately, even with tweaking it's not exactly 100%.

Yes, that's why one still needs to understand more about headers in the Linux kernel to do such a "simple" change.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+#include <linux/string.h>

Hmm... What's used for here?

sysfs_streq() is defined in linux/string.h.

Oh, surprise surprise :-), thanks for pointing this out!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 2 lines · Andy Shevchenko

Yes, that's why one still needs to understand more about headers in the Linux kernel to do such a "simple" change.

Yup, it's definitely a task that seems easy on the surface level (but isn't). Also the concept of
kernel.h is truly a fun one.

Quoted 1 line

Oh, surprise surprise :-), thanks for pointing this out!

No problem, surprisingly one of the things that IWYU got right.

Signature · 3 lines
Kind regards

CJD
maintainer
#5 lore raw
Quoted 5 lines · On Fri, 17 Apr 2026 09:34:38 +0200 Joshua Crofts <[email protected]>…
Quoted 2 lines · Andy Shevchenko

Yes, that's why one still needs to understand more about headers in the Linux kernel to do such a "simple" change.

Quoted 8 lines

Yup, it's definitely a task that seems easy on the surface level (but isn't). Also the concept of
kernel.h is truly a fun one.

Quoted 1 line

Oh, surprise surprise :-), thanks for pointing this out!

No problem, surprisingly one of the things that IWYU got right.

Looks fine to me.
Applied to the testing branch of iio.git

Thanks,

Jonathan