Skip to contentSkip to conversation

watchdog: Don't use "proxy" inclusions

PATCH In review Andy Shevchenko 2 participants 5 messages Jul 8, 2025 – Jul 17, 2025 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

v3 cover watchdog: Don't use "proxy" inclusions

Update header inclusions to follow IWYU (Include What You Use) principle.

Note that kernel.h is discouraged to be included as it's written at the top of that file.

Changelog v3:
- added prerequisite to avoid compilation errors (LKP, Guenter)

Andy Shevchenko (2):
watchdog: it87_wdt: Don't use "proxy" headers
watchdog: Don't use "proxy" headers

 drivers/watchdog/it87_wdt.c            |  4 +++-
 drivers/watchdog/watchdog_core.h       |  8 +++++++-
 drivers/watchdog/watchdog_pretimeout.c |  2 ++
 include/linux/watchdog.h               | 12 ++++++++----
 4 files changed, 20 insertions(+), 6 deletions(-)
Signature · 1 line
2.47.2
#1 lore raw

PATCH v3 1/2 watchdog: it87_wdt: Don't use "proxy" headers

Update header inclusions to follow IWYU (Include What You Use) principle.

Note that kernel.h is discouraged to be included as it's written at the top of that file.

---
 drivers/watchdog/it87_wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/it87_wdt.c +3 -1
index a1e23dce8810..3b8488c86a2f 100644
@@ -22,11 +22,13 @@
 
 #include <linux/bits.h>
 #include <linux/dmi.h>
+#include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/kernel.h>
+#include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/printk.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
 
Signature · 1 line
2.47.2
maintainer Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] watchdog: it87_wdt: Don't use "proxy" headers

Quoted 7 lines · Andy Shevchenko

Update header inclusions to follow IWYU (Include What You Use) principle.

Note that kernel.h is discouraged to be included as it's written at the top of that file.

Quoted 23 lines
---
  drivers/watchdog/it87_wdt.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/it87_wdt.c +3 -1
index a1e23dce8810..3b8488c86a2f 100644
@@ -22,11 +22,13 @@
 
  #include <linux/bits.h>
  #include <linux/dmi.h>
+#include <linux/errno.h>
  #include <linux/init.h>
  #include <linux/io.h>
-#include <linux/kernel.h>
+#include <linux/ioport.h>
  #include <linux/module.h>
  #include <linux/moduleparam.h>
+#include <linux/printk.h>
  #include <linux/types.h>
  #include <linux/watchdog.h>
 
#3 lore raw

PATCH v3 2/2 watchdog: Don't use "proxy" headers

In reply to Andy Shevchenko

Update header inclusions to follow IWYU (Include What You Use) principle.

Note that kernel.h is discouraged to be included as it's written at the top of that file.

---
 drivers/watchdog/watchdog_core.h       |  8 +++++++-
 drivers/watchdog/watchdog_pretimeout.c |  2 ++
 include/linux/watchdog.h               | 12 ++++++++----
 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_core.h +7 -1
index 5b35a8439e26..ab825d9f9248 100644
@@ -24,8 +24,14 @@
  *	This material is provided "AS-IS" and at no charge.
  */
 
-#include <linux/hrtimer.h>
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/hrtimer_types.h>
+#include <linux/init.h>
 #include <linux/kthread.h>
+#include <linux/mutex_types.h>
+#include <linux/types.h>
+#include <linux/watchdog.h>
 
 #define MAX_DOGS	32	/* Maximum number of watchdog devices */
 
drivers/watchdog/watchdog_pretimeout.c +2 -0
index e5295c990fa1..2526436dc74d 100644
@@ -7,6 +7,8 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
 #include <linux/watchdog.h>
 
 #include "watchdog_core.h"
include/linux/watchdog.h +8 -4
index 99660197a36c..8c60687a3e55 100644
@@ -9,14 +9,18 @@
 #ifndef _LINUX_WATCHDOG_H
 #define _LINUX_WATCHDOG_H
 
-
 #include <linux/bitops.h>
-#include <linux/cdev.h>
-#include <linux/device.h>
-#include <linux/kernel.h>
+#include <linux/limits.h>
 #include <linux/notifier.h>
+#include <linux/printk.h>
+#include <linux/types.h>
+
 #include <uapi/linux/watchdog.h>
 
+struct attribute_group;
+struct device;
+struct module;
+
 struct watchdog_ops;
 struct watchdog_device;
 struct watchdog_core_data;
Signature · 1 line
2.47.2
maintainer Reviewed-by on v3 2/2
#4 lore raw

Re: [PATCH v3 2/2] watchdog: Don't use "proxy" headers

Quoted 7 lines · Andy Shevchenko

Update header inclusions to follow IWYU (Include What You Use) principle.

Note that kernel.h is discouraged to be included as it's written at the top of that file.

Quoted 66 lines
---
  drivers/watchdog/watchdog_core.h       |  8 +++++++-
  drivers/watchdog/watchdog_pretimeout.c |  2 ++
  include/linux/watchdog.h               | 12 ++++++++----
  3 files changed, 17 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_core.h +7 -1
index 5b35a8439e26..ab825d9f9248 100644
@@ -24,8 +24,14 @@
   *	This material is provided "AS-IS" and at no charge.
   */
 
-#include <linux/hrtimer.h>
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/hrtimer_types.h>
+#include <linux/init.h>
  #include <linux/kthread.h>
+#include <linux/mutex_types.h>
+#include <linux/types.h>
+#include <linux/watchdog.h>
 
  #define MAX_DOGS	32	/* Maximum number of watchdog devices */
 
drivers/watchdog/watchdog_pretimeout.c +2 -0
index e5295c990fa1..2526436dc74d 100644
@@ -7,6 +7,8 @@
  #include <linux/slab.h>
  #include <linux/spinlock.h>
  #include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
  #include <linux/watchdog.h>
 
  #include "watchdog_core.h"
include/linux/watchdog.h +8 -4
index 99660197a36c..8c60687a3e55 100644
@@ -9,14 +9,18 @@
  #ifndef _LINUX_WATCHDOG_H
  #define _LINUX_WATCHDOG_H
 
-
  #include <linux/bitops.h>
-#include <linux/cdev.h>
-#include <linux/device.h>
-#include <linux/kernel.h>
+#include <linux/limits.h>
  #include <linux/notifier.h>
+#include <linux/printk.h>
+#include <linux/types.h>
+
  #include <uapi/linux/watchdog.h>
 
+struct attribute_group;
+struct device;
+struct module;
+
  struct watchdog_ops;
  struct watchdog_device;
  struct watchdog_core_data;