Skip to contentSkip to conversation

iio: frequency: ad9834: clean up includes

PATCH Superseded Joshua Crofts 2 participants 4 messages Apr 15 – Apr 16

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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. Reordered remaining drivers alphabetically.

Verified using IWYU.

---
v2:
- dropped patches from from previous iteration of patch series
- removed additional unused headers
- returned bits.h as driver only uses BIT() macro

 drivers/staging/iio/frequency/ad9834.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/staging/iio/frequency/ad9834.c +5 -8
index d339d5e8e0..465b2fa7a4 100644
@@ -5,18 +5,15 @@
  * 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/err.h>
 #include <linux/module.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/sysfs.h>
+
 #include <asm/div64.h>
 
 #include <linux/iio/iio.h>
Signature · 1 line
2.47.3
#1 lore raw
Quoted 3 lines · Joshua Crofts

Cleanup include headers by removing proxy kernel.h header and unnecessary list.h, interrupt.h, workqueue.h and slab.h headers. Reordered remaining drivers

s/drivers/headers/

Quoted 3 lines

alphabetically.

Verified using IWYU.

Probably you need to somehow elaborate that this is tool, IWYU is the acronym of the principle, tool called 'iwyu'. Maybe adding a link?

"Verified with help of IWYU tool (...here is URL...).

Quoted 1 line

...

Quoted 6 lines
drivers/staging/iio/frequency/ad9834.c +1 -3
+#include <linux/bits.h>
 #include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/workqueue.h>
 #include <linux/device.h>
-#include <linux/kernel.h>

drivers/staging/iio/frequency/ad9834.c line 15

Quoted 10 lines
drivers/staging/iio/frequency/ad9834.c +3 -5
-#include <linux/slab.h>
-#include <linux/sysfs.h>
-#include <linux/list.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/consumer.h>
 #include <linux/err.h>
 #include <linux/module.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/sysfs.h>

Still missing types.h, math.h, and probably more...

Yes, asm/byteorder.h, kstrtox.h, mutex.h. And maybe even more, I just briefly scrolled over the driver code.

If you look at Git history of the replacement kernel.h in the drivers you may find that usually it takes 10+ headers to be added.

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

Still missing types.h, math.h, and probably more...

I don't get why I should include a math header (I presume you meant something like linux/math64.h), since we're only using do_div(), which is a macro from asm/div64.h (which linux/math64.h includes). Last time I came up with this, you recommended working on this in another patch.

Signature · 3 lines
Kind regards

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

Still missing types.h, math.h, and probably more...

I don't get why I should include a math header (I presume you meant something like linux/math64.h), since we're only using do_div(), which is a macro from asm/div64.h (which linux/math64.h includes). Last time I came up with this, you recommended working on this in another patch.

Ah, sorry, yes, currently included asm/div64.h is fine. If we ever want to replace that, we need to do it treewide.

Signature · 2 lines
With Best Regards,
Andy Shevchenko