Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: accel: kionix-kx022a: Apply approximate iwyu principles to includes
@ 2025-06-29 18:36 Jonathan Cameron
  2025-06-29 18:43 ` Jonathan Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jonathan Cameron @ 2025-06-29 18:36 UTC (permalink / raw)
  To: linux-iio, Nuno Sá, Andy Shevchenko, David Lechner,
	Matti Vaittinen
  Cc: Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Motivated by the W=1 warning about export.h that was introduced this cycle
this is an attempt to apply an approximation of the principles of including
whatever is used in the file directly.

Helped by the include-what-you-use tool.

Reasoning:
- Drop linux/moduleparam.h as completely unused.
- linux/array_size.h for ARRAY_SIZE()
- linux/bitmap.h for for_each_set_bit
- linux/errno.h for error codes.
- linux/export.h for EXPORT_SYMBOL*()
- linux/math64.h for do_div - alternative would be asm/div64.h
- linux/minmax.h for min()
- linux/sysfs.h for sysfs_emit()
- linux/time64.h for USEC_PER_MSEC
- linux/iio/buffer.h for iio_push_to_buffers_with_timestamp()
- asm/byteorder.h for le16_to_cpu()

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---

I picked this one fairly randomly as an example but longer term I'd like
to look through at least all new drivers with this in mind + all the ones
that are currently messing up my W=1 build logs.

Note I've been very descriptive in this patch to allow people to suggest
better alternatives for some of the ones that aren't entirely obvious.

---
 drivers/iio/accel/kionix-kx022a.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
index 07dcf5f0599f..39485572a76b 100644
--- a/drivers/iio/accel/kionix-kx022a.c
+++ b/drivers/iio/accel/kionix-kx022a.c
@@ -5,27 +5,37 @@
  * ROHM/KIONIX accelerometer driver
  */
 
+#include <linux/array_size.h>
+#include <linux/bitmap.h>
 #include <linux/cleanup.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/export.h>
 #include <linux/interrupt.h>
+#include <linux/math64.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/string_choices.h>
+#include <linux/sysfs.h>
+#include <linux/time64.h>
 #include <linux/types.h>
 #include <linux/units.h>
 
 #include <linux/iio/iio.h>
+#include <linux/iio/buffer.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <asm/byteorder.h>
+
 #include "kionix-kx022a.h"
 
 /*
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-07-12 16:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-29 18:36 [PATCH] iio: accel: kionix-kx022a: Apply approximate iwyu principles to includes Jonathan Cameron
2025-06-29 18:43 ` Jonathan Cameron
2025-06-30 10:42   ` Andy Shevchenko
2025-06-30 14:06     ` Jonathan Cameron
2025-07-12 16:52       ` Tanzir Hasan
2025-06-30 10:40 ` Andy Shevchenko
2025-07-06 17:13   ` Jonathan Cameron
2025-07-10  6:53     ` Matti Vaittinen
2025-07-07 19:53 ` Andy Shevchenko
2025-07-09 13:32   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox