Skip to contentSkip to conversation

iio: chemical: scd30: remove kernel.h header

PATCH In review Maxwell Doose 3 participants 4 messages Jul 12 – Jul 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: chemical: scd30: remove kernel.h header

kernel.h is no longer recommended for usage because it can cause longer build times and pull in transient dependencies. In addition, it's not being used by the SCD30 driver. Remove it.

---
 drivers/iio/chemical/scd30_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/chemical/scd30_core.c +0 -1
index f85cdd8bd84f..40bbf26a667b 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irqreturn.h>
 #include <linux/jiffies.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/regulator/consumer.h>
Signature · 1 line
2.54.0
#1 lore raw
Quoted 14 lines · On Sun, 12 Jul 2026 11:42:25 -0500 Maxwell Doose <[email protected]> wrote:

kernel.h is no longer recommended for usage because it can cause longer build times and pull in transient dependencies. In addition, it's not being used by the SCD30 driver. Remove it.

---
 drivers/iio/chemical/scd30_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/chemical/scd30_core.c +0 -0
index f85cdd8bd84f..40bbf26a667b 100644

drivers/iio/chemical/scd30_core.c line 28

Quoted 7 lines
drivers/iio/chemical/scd30_core.c +0 -1
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irqreturn.h>
 #include <linux/jiffies.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/regulator/consumer.h>

Since you're doing IWYU stuff, you should also remove errno.h and add err.h instead, as the code uses IS_ERR() etc. and err.h includes errno.h

Also consider grouping the iio headers and asm headers separately. (separate patch though). The include list looks overwhelming!

Signature · 3 lines
Kind regards

CJD
#2 lore raw
Quoted 12 lines · CDT Joshua Crofts
Quoted 9 lines · On Sun, 12 Jul 2026 11:42:25 -0500 Maxwell Doose <[email protected]> wrote:

kernel.h is no longer recommended for usage because it can cause longer build times and pull in transient dependencies. In addition, it's not being used by the SCD30 driver. Remove it.

---
 drivers/iio/chemical/scd30_core.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines

drivers/iio/chemical/scd30_core.c line 28

Quoted 12 lines
drivers/iio/chemical/scd30_core.c +0 -1
index f85cdd8bd84f..40bbf26a667b 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irqreturn.h>
 #include <linux/jiffies.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/regulator/consumer.h>

Since you're doing IWYU stuff, you should also remove errno.h and add err.h instead, as the code uses IS_ERR() etc. and err.h includes errno.h

I tried to set up iwyu-tool to no avail, but I can send a v2 with that.

Quoted 2 lines

Also consider grouping the iio headers and asm headers separately. (separate patch though). The include list looks overwhelming!

Indeed it is but we try our best. Good thing is the more we remove unneeded headers the better it gets.

Signature · 2 lines
best regards,
max
#3 lore raw
Quoted 33 lines · On Sun, 12 Jul 2026 13:47:24 -0500 "Maxwell Doose" <[email protected]> wrote:
Quoted 12 lines · CDT Joshua Crofts
Quoted 9 lines · On Sun, 12 Jul 2026 11:42:25 -0500 Maxwell Doose <[email protected]> wrote:

kernel.h is no longer recommended for usage because it can cause longer build times and pull in transient dependencies. In addition, it's not being used by the SCD30 driver. Remove it.

---
 drivers/iio/chemical/scd30_core.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines

drivers/iio/chemical/scd30_core.c line 28

Quoted 12 lines
drivers/iio/chemical/scd30_core.c +0 -1
index f85cdd8bd84f..40bbf26a667b 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irqreturn.h>
 #include <linux/jiffies.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/regulator/consumer.h>  

Since you're doing IWYU stuff, you should also remove errno.h and add err.h instead, as the code uses IS_ERR() etc. and err.h includes errno.h

Quoted 8 lines

I tried to set up iwyu-tool to no avail, but I can send a v2 with that.

Quoted 2 lines

Also consider grouping the iio headers and asm headers separately. (separate patch though). The include list looks overwhelming!

Indeed it is but we try our best. Good thing is the more we remove unneeded headers the better it gets.

As a side note, (and I haven't checked it)
Sashiko had some interesting other stuff noticed whilst I reviewed this:
https://sashiko.dev/#/patchset/20260712164225.358852-1-m32285159%40gmail.com

If anyone has time to take a look the CMD_TEMP_OFFSET / 10 indeed looks obviously wrong. + I moved that code without even noticing whilst using guard() in this driver :(

Jonathan