[PATCH v2 3/5] iio: dac: ad5504: Align headers with IWYU principle

Taha Ed-Dafili posted 5 patches 4 weeks ago
[PATCH v2 3/5] iio: dac: ad5504: Align headers with IWYU principle
Posted by Taha Ed-Dafili 4 weeks ago
Update the header inclusions to follow the IWYU principle.

- Remove <linux/fs.h> and <linux/slab.h> as they are unused. The driver
relies on devm_ managed allocations, so slab is not required.

- Replace <linux/bitops.h> with <linux/bits.h> as only the BIT() and
GENMASK() macros are used.

- Add <linux/mod_devicetable.h> for struct spi_device_id.

- Add <linux/errno.h> and <linux/types.h> for error codes and data types.

Suggested-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 20a36e4a389e..e71218c44982 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -5,16 +5,17 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
-#include <linux/bitops.h>
+#include <linux/bits.h>
 #include <linux/device.h>
-#include <linux/fs.h>
+#include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
-#include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
+#include <linux/types.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
-- 
2.47.3
Re: [PATCH v2 3/5] iio: dac: ad5504: Align headers with IWYU principle
Posted by Andy Shevchenko 4 weeks ago
On Tue, Mar 10, 2026 at 05:48:33PM +0000, Taha Ed-Dafili wrote:
> Update the header inclusions to follow the IWYU principle.
> 
> - Remove <linux/fs.h> and <linux/slab.h> as they are unused. The driver
> relies on devm_ managed allocations, so slab is not required.

...

> -#include <linux/bitops.h>
> +#include <linux/bits.h>

>  #include <linux/device.h>

Is this still being used directly.

> -#include <linux/fs.h>
> +#include <linux/errno.h>
>  #include <linux/interrupt.h>

>  #include <linux/kernel.h>

And what is this for?

> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/regulator/consumer.h>
> -#include <linux/slab.h>
>  #include <linux/spi/spi.h>
>  #include <linux/sysfs.h>
> +#include <linux/types.h>

The rest of the changes looks correct, but still missing headers:
linux/kstrtox.h

asm/byteorder.h

Might be more.

-- 
With Best Regards,
Andy Shevchenko