Skip to contentSkip to conversation

watchdog: Don't use "proxy" headers

PATCH Superseded Andy Shevchenko 3 participants 3 messages Jun 27, 2025 – Jul 7, 2025 Watchdog device drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 watchdog: 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.

---

v2: fixed multiple compilation errors (LKP)

 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
#1 lore raw
kernel test robot noticed the following build errors:

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v6.16-rc4 next-20250704] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/watchdog-Don-t-use-proxy-headers/20250627-153933
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20250627073753.589509-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v2 1/1] watchdog: Don't use "proxy" headers
config: i386-randconfig-052-20250706 (https://download.01.org/0day-ci/archive/20250707/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250707/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/watchdog/it87_wdt.c: In function 'superio_enter':

>> drivers/watchdog/it87_wdt.c:121:14: error: implicit declaration of function 'request_muxed_region' [-Werror=implicit-function-declaration]
     121 |         if (!request_muxed_region(REG, 2, WATCHDOG_NAME))
         |              ^~~~~~~~~~~~~~~~~~~~
   drivers/watchdog/it87_wdt.c: In function 'superio_exit':
>> drivers/watchdog/it87_wdt.c:135:9: error: implicit declaration of function 'release_region' [-Werror=implicit-function-declaration]
     135 |         release_region(REG, 2);
         |         ^~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/request_muxed_region +121 drivers/watchdog/it87_wdt.c

e1fee94f346387 Oliver Schuster 2008-03-05  115  
a134b825608df6 Nat Gurumoorthy 2011-05-09  116  static inline int superio_enter(void)
e1fee94f346387 Oliver Schuster 2008-03-05  117  {
a134b825608df6 Nat Gurumoorthy 2011-05-09  118  	/*
a134b825608df6 Nat Gurumoorthy 2011-05-09  119  	 * Try to reserve REG and REG + 1 for exclusive access.
a134b825608df6 Nat Gurumoorthy 2011-05-09  120  	 */
a134b825608df6 Nat Gurumoorthy 2011-05-09 @121  	if (!request_muxed_region(REG, 2, WATCHDOG_NAME))
a134b825608df6 Nat Gurumoorthy 2011-05-09  122  		return -EBUSY;
a134b825608df6 Nat Gurumoorthy 2011-05-09  123  
e1fee94f346387 Oliver Schuster 2008-03-05  124  	outb(0x87, REG);
e1fee94f346387 Oliver Schuster 2008-03-05  125  	outb(0x01, REG);
e1fee94f346387 Oliver Schuster 2008-03-05  126  	outb(0x55, REG);
e1fee94f346387 Oliver Schuster 2008-03-05  127  	outb(0x55, REG);
a134b825608df6 Nat Gurumoorthy 2011-05-09  128  	return 0;
e1fee94f346387 Oliver Schuster 2008-03-05  129  }
e1fee94f346387 Oliver Schuster 2008-03-05  130  
e1fee94f346387 Oliver Schuster 2008-03-05  131  static inline void superio_exit(void)
e1fee94f346387 Oliver Schuster 2008-03-05  132  {
e1fee94f346387 Oliver Schuster 2008-03-05  133  	outb(0x02, REG);
e1fee94f346387 Oliver Schuster 2008-03-05  134  	outb(0x02, VAL);

a134b825608df6 Nat Gurumoorthy 2011-05-09 @135 release_region(REG, 2);
e1fee94f346387 Oliver Schuster 2008-03-05 136 }
e1fee94f346387 Oliver Schuster 2008-03-05 137

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#2 lore raw
In reply to Andy Shevchenko
Quoted 6 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.

0-day still reports:

All errors (new ones prefixed by >>):

drivers/watchdog/it87_wdt.c: In function 'superio_enter':

Quoted 1 line
Quoted 1 line

drivers/watchdog/it87_wdt.c:121:14: error: implicit declaration of function 'request_muxed_region' [-Werror=implicit-function-declaration]

121 | if (!request_muxed_region(REG, 2, WATCHDOG_NAME))
| ^~~~~~~~~~~~~~~~~~~~
drivers/watchdog/it87_wdt.c: In function 'superio_exit':

Quoted 1 line
Quoted 1 line

drivers/watchdog/it87_wdt.c:135:9: error: implicit declaration of function 'release_region' [-Werror=implicit-function-declaration]

     135 |         release_region(REG, 2);

Guenter