[PATCH v3] iio: frequency: ad9834: clean up includes

Joshua Crofts posted 1 patch 2 months ago
drivers/staging/iio/frequency/ad9834.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
[PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Joshua Crofts 2 months ago
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.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/staging/iio/frequency/ad9834.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index d339d5e8e0..9b65fbe1c7 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -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>
-- 
2.47.3
Re: [PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Andy Shevchenko 1 month, 4 weeks ago
On Thu, Apr 16, 2026 at 09:32:40AM +0000, Joshua Crofts wrote:
> 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...

...

> +#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>

Hmm... What's used for here?

> +#include <linux/sysfs.h>
> +#include <linux/types.h>
> +
> +#include <asm/byteorder.h>
>  #include <asm/div64.h>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Joshua Crofts 1 month, 4 weeks ago
On Fri, 17 Apr 2026 at 08:47, Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
> 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%.

> > +#include <linux/string.h>
>
> Hmm... What's used for here?

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

-- 
Kind regards

CJD
Re: [PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Andy Shevchenko 1 month, 4 weeks ago
On Fri, Apr 17, 2026 at 09:13:27AM +0200, Joshua Crofts wrote:
> On Fri, 17 Apr 2026 at 08:47, Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > 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.

> > > +#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!

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Joshua Crofts 1 month, 4 weeks ago
On Fri, 17 Apr 2026 at 09:26, Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
> 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.

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

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

-- 
Kind regards

CJD
Re: [PATCH v3] iio: frequency: ad9834: clean up includes
Posted by Jonathan Cameron 1 month, 3 weeks ago
On Fri, 17 Apr 2026 09:34:38 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Fri, 17 Apr 2026 at 09:26, Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > 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.
> 
> > 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