All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org, "Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>
Cc: Denis Ciocca <denis.ciocca@st.com>,
	Vasileios Amoiridis <vassilisamir@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 2/7] iio: pressure: zpa2326: Apply iwyu principles to includes
Date: Thu, 10 Jul 2025 18:11:02 +0100	[thread overview]
Message-ID: <20250710171107.443790-3-jic23@kernel.org> (raw)
In-Reply-To: <20250710171107.443790-1-jic23@kernel.org>

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

Motivated by the new warning when W=1 if linux/exports.h is not included
but the macros within it are used.  Given the includes need improving go
the whole way and apply include what you use principles to this driver.

Reasoning:
- First sort includes into alphabetical order, keeping the separate iio
  specific block and asm blocks as appropriate.
Drop:
- linux/kernel.h
Add:
- asm/byteorder.h for le16_to_cpup()
- linux/array_size.h for ARRAY_SIZE()
- linux/bitops.h for test_bit() (also BIT() etc in c files0
- linux/bits.h for BIT() in the header.
- linux/completion.h cof complete()
- linux/device.h for struct device
- linux/err.h for IS_ERR() and error codes.
- linux/export.h for EXPORT_SYMBOL*
- linux/jiffies.h for jiffies and HZ (in param.h)
- linux/pm.h for SET_RUNTIME_PM_OPS etc
  Note that the way this driver handles CONFIG_PM is messy but not topic
  for this series.
- linux/stddef.h for true / false etc
- linux/sysfs.h for struct attribute_group

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/pressure/zpa2326.c     | 20 ++++++++++++++++----
 drivers/iio/pressure/zpa2326.h     |  3 +++
 drivers/iio/pressure/zpa2326_i2c.c |  7 +++++--
 drivers/iio/pressure/zpa2326_spi.c |  6 +++++-
 4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index 6eef37c0952d..34743ee0be07 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -51,20 +51,32 @@
  *   hardware samples averaging.
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
+#include <linux/array_size.h>
+#include <linux/bitops.h>
+#include <linux/completion.h>
 #include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/export.h>
 #include <linux/interrupt.h>
-#include <linux/regulator/consumer.h>
+#include <linux/module.h>
+#include <linux/jiffies.h>
+#include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/stddef.h>
+#include <linux/sysfs.h>
+#include <linux/unaligned.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
-#include <linux/unaligned.h>
+
+#include <asm/byteorder.h>
 #include "zpa2326.h"
 
 /* 200 ms should be enough for the longest conversion time in one-shot mode. */
diff --git a/drivers/iio/pressure/zpa2326.h b/drivers/iio/pressure/zpa2326.h
index 45bd7900975b..a1ab574241eb 100644
--- a/drivers/iio/pressure/zpa2326.h
+++ b/drivers/iio/pressure/zpa2326.h
@@ -10,6 +10,9 @@
 #ifndef _ZPA2326_H
 #define _ZPA2326_H
 
+#include <linux/bits.h>
+#include <linux/types.h>
+
 /* Register map. */
 #define ZPA2326_REF_P_XL_REG              (0x8)
 #define ZPA2326_REF_P_L_REG               (0x9)
diff --git a/drivers/iio/pressure/zpa2326_i2c.c b/drivers/iio/pressure/zpa2326_i2c.c
index a6034bf05d97..ca05b84f420a 100644
--- a/drivers/iio/pressure/zpa2326_i2c.c
+++ b/drivers/iio/pressure/zpa2326_i2c.c
@@ -7,10 +7,13 @@
  * Author: Gregor Boirie <gregor.boirie@parrot.com>
  */
 
-#include <linux/module.h>
-#include <linux/regmap.h>
+#include <linux/bits.h>
+#include <linux/device.h>
+#include <linux/err.h>
 #include <linux/i2c.h>
+#include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/regmap.h>
 #include "zpa2326.h"
 
 /*
diff --git a/drivers/iio/pressure/zpa2326_spi.c b/drivers/iio/pressure/zpa2326_spi.c
index af756e2b0f31..14f8b2b809a0 100644
--- a/drivers/iio/pressure/zpa2326_spi.c
+++ b/drivers/iio/pressure/zpa2326_spi.c
@@ -7,10 +7,14 @@
  * Author: Gregor Boirie <gregor.boirie@parrot.com>
  */
 
+#include <linux/bits.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/spi/spi.h>
-#include <linux/mod_devicetable.h>
 #include "zpa2326.h"
 
 /*
-- 
2.50.0


  parent reply	other threads:[~2025-07-10 17:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10 17:11 [PATCH 0/7] IIO: More application of IWYU principles to includes Jonathan Cameron
2025-07-10 17:11 ` [PATCH 1/7] iio: pressure: bmp280: Apply iwyu " Jonathan Cameron
2025-07-10 19:09   ` Andy Shevchenko
2025-07-10 17:11 ` Jonathan Cameron [this message]
2025-07-10 17:11 ` [PATCH 3/7] iio: pressure: mpl115: " Jonathan Cameron
2025-07-10 17:11 ` [PATCH 4/7] iio: pressure: ms5611: " Jonathan Cameron
2025-07-10 17:11 ` [PATCH 5/7] iio: pressure: hsc030pa: Apply IWYU " Jonathan Cameron
2025-07-10 17:11 ` [PATCH 6/7] iio: pressure: mprls0025pa: " Jonathan Cameron
2025-07-10 17:11 ` [PATCH 7/7] iio: st_sensors: " Jonathan Cameron
2025-07-10 19:09 ` [PATCH 0/7] IIO: More application of " Andy Shevchenko
2025-07-10 19:28   ` David Lechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250710171107.443790-3-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=vassilisamir@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.