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 3/7] iio: pressure: mpl115: Apply iwyu principles to includes
Date: Thu, 10 Jul 2025 18:11:03 +0100	[thread overview]
Message-ID: <20250710171107.443790-4-jic23@kernel.org> (raw)
In-Reply-To: <20250710171107.443790-1-jic23@kernel.org>

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

Motivated by fixing the new W=1 warning for lack of include of
linux/export.h this reworks all the includes for this driver
along the lines of approximate include what you use principles.

One question here is what to do about gfp_types.h.
For now I've added a rule to allow GFP_KERNEL to come from linux/slab.h
or linux/device.h (for devm_ calls).  In this driver slab.h is
never used directly so linux/device.h provides the symbol.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/pressure/mpl115.c     | 13 ++++++++++---
 drivers/iio/pressure/mpl115.h     |  1 +
 drivers/iio/pressure/mpl115_i2c.c |  8 +++++++-
 drivers/iio/pressure/mpl115_spi.c |  5 +++++
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
index 71beb28b7f2c..448d030d5621 100644
--- a/drivers/iio/pressure/mpl115.c
+++ b/drivers/iio/pressure/mpl115.c
@@ -6,11 +6,18 @@
  *
  * TODO: synchronization with system suspend
  */
-
-#include <linux/module.h>
-#include <linux/iio/iio.h>
+#include <linux/array_size.h>
+#include <linux/bits.h>
 #include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/export.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/pm_runtime.h>
+#include <linux/stddef.h>
+#include <linux/iio/iio.h>
 
 #include "mpl115.h"
 
diff --git a/drivers/iio/pressure/mpl115.h b/drivers/iio/pressure/mpl115.h
index 78a0068a17bb..480ee112f134 100644
--- a/drivers/iio/pressure/mpl115.h
+++ b/drivers/iio/pressure/mpl115.h
@@ -7,6 +7,7 @@
  */
 
 #include <linux/pm_runtime.h>
+#include <linux/types.h>
 
 #ifndef _MPL115_H_
 #define _MPL115_H_
diff --git a/drivers/iio/pressure/mpl115_i2c.c b/drivers/iio/pressure/mpl115_i2c.c
index 3db9ef4e2770..160cf1e5a317 100644
--- a/drivers/iio/pressure/mpl115_i2c.c
+++ b/drivers/iio/pressure/mpl115_i2c.c
@@ -9,11 +9,17 @@
  * Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MPL115A2.pdf
  */
 
-#include <linux/module.h>
+#include <linux/errno.h>
 #include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/types.h>
 
 #include "mpl115.h"
 
+struct device;
+
 static int mpl115_i2c_init(struct device *dev)
 {
 	return 0;
diff --git a/drivers/iio/pressure/mpl115_spi.c b/drivers/iio/pressure/mpl115_spi.c
index 4e1d24beff94..26df328769a4 100644
--- a/drivers/iio/pressure/mpl115_spi.c
+++ b/drivers/iio/pressure/mpl115_spi.c
@@ -7,8 +7,13 @@
  * Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MPL115A1.pdf
  */
 
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/pm.h>
 #include <linux/spi/spi.h>
+#include <linux/types.h>
 
 #include "mpl115.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 ` [PATCH 2/7] iio: pressure: zpa2326: " Jonathan Cameron
2025-07-10 17:11 ` Jonathan Cameron [this message]
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-4-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.