diff mbox series

[v1,1/1] watchdog: nic7018_wdt: tidy up ACPI ID table

Message ID 20250225095804.360899-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New
Headers show
Series [v1,1/1] watchdog: nic7018_wdt: tidy up ACPI ID table | expand

Commit Message

Andy Shevchenko Feb. 25, 2025, 9:58 a.m. UTC
Tidy up ACPI ID table:
- drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h
- remove explicit driver_data initializer
- drop comma in the terminator entry

With that done, extend compile test coverage.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/watchdog/Kconfig       | 3 ++-
 drivers/watchdog/nic7018_wdt.c | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

Comments

Andy Shevchenko Feb. 25, 2025, 11 a.m. UTC | #1
On Tue, Feb 25, 2025 at 11:58:04AM +0200, Andy Shevchenko wrote:
> Tidy up ACPI ID table:
> - drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h
> - remove explicit driver_data initializer
> - drop comma in the terminator entry
> 
> With that done, extend compile test coverage.

...

>  config NIC7018_WDT
>  	tristate "NIC7018 Watchdog"
> -	depends on X86 && ACPI
> +	depends on HAS_IOMEM

Oh, this should be HAS_IOPORT, compiling on X86 won't help to find this issue
:-)

> +	depends on ACPI || COMPILE_TEST
>  	select WATCHDOG_CORE
kernel test robot Feb. 25, 2025, 9:14 p.m. UTC | #2
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.14-rc4 next-20250225]
[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-nic7018_wdt-tidy-up-ACPI-ID-table/20250225-180908
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20250225095804.360899-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] watchdog: nic7018_wdt: tidy up ACPI ID table
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20250226/202502260415.PSbWYkXd-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250226/202502260415.PSbWYkXd-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502260415.PSbWYkXd-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/s390/include/asm/io.h:95,
                    from include/linux/io.h:14,
                    from drivers/watchdog/nic7018_wdt.c:8:
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_remove':
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:229:9: note: in expansion of macro 'outb'
     229 |         outb(LOCK, wdt->io_base + WDT_REG_LOCK);
         |         ^~~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_set_timeout':
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:96:9: note: in expansion of macro 'outb'
      96 |         outb(counter << 4 | config->divider,
         |         ^~~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_ping':
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:138:9: note: in expansion of macro 'outb'
     138 |         outb(1, wdt->io_base + WDT_RELOAD_PORT);
         |         ^~~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_stop':
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:127:9: note: in expansion of macro 'outb'
     127 |         outb(0, wdt->io_base + WDT_CTRL);
         |         ^~~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:128:9: note: in expansion of macro 'outb'
     128 |         outb(0, wdt->io_base + WDT_RELOAD_CTRL);
         |         ^~~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:129:9: note: in expansion of macro 'outb'
     129 |         outb(0xF0, wdt->io_base + WDT_PRESET_PRESCALE);
         |         ^~~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_get_timeleft':
>> include/asm-generic/io.h:542:14: error: call to '_inb' declared with attribute error: inb()) requires CONFIG_HAS_IOPORT
     542 | #define _inb _inb
   include/asm-generic/io.h:643:13: note: in expansion of macro '_inb'
     643 | #define inb _inb
         |             ^~~~
   drivers/watchdog/nic7018_wdt.c:148:17: note: in expansion of macro 'inb'
     148 |         count = inb(wdt->io_base + WDT_COUNT) & 0xF;
         |                 ^~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_start':
>> include/asm-generic/io.h:542:14: error: call to '_inb' declared with attribute error: inb()) requires CONFIG_HAS_IOPORT
     542 | #define _inb _inb
   include/asm-generic/io.h:643:13: note: in expansion of macro '_inb'
     643 | #define inb _inb
         |             ^~~~
   drivers/watchdog/nic7018_wdt.c:112:19: note: in expansion of macro 'inb'
     112 |         control = inb(wdt->io_base + WDT_RELOAD_CTRL);
         |                   ^~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:113:9: note: in expansion of macro 'outb'
     113 |         outb(control | WDT_RELOAD_PORT_EN, wdt->io_base + WDT_RELOAD_CTRL);
         |         ^~~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:115:9: note: in expansion of macro 'outb'
     115 |         outb(1, wdt->io_base + WDT_RELOAD_PORT);
         |         ^~~~
>> include/asm-generic/io.h:542:14: error: call to '_inb' declared with attribute error: inb()) requires CONFIG_HAS_IOPORT
     542 | #define _inb _inb
   include/asm-generic/io.h:643:13: note: in expansion of macro '_inb'
     643 | #define inb _inb
         |             ^~~~
   drivers/watchdog/nic7018_wdt.c:117:19: note: in expansion of macro 'inb'
     117 |         control = inb(wdt->io_base + WDT_CTRL);
         |                   ^~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:118:9: note: in expansion of macro 'outb'
     118 |         outb(control | WDT_CTRL_RESET_EN, wdt->io_base + WDT_CTRL);
         |         ^~~~
   drivers/watchdog/nic7018_wdt.c: In function 'nic7018_probe':
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:209:9: note: in expansion of macro 'outb'
     209 |         outb(UNLOCK, wdt->io_base + WDT_REG_LOCK);
         |         ^~~~
>> include/asm-generic/io.h:596:15: error: call to '_outb' declared with attribute error: outb() requires CONFIG_HAS_IOPORT
     596 | #define _outb _outb
   include/asm-generic/io.h:655:14: note: in expansion of macro '_outb'
     655 | #define outb _outb
         |              ^~~~~
   drivers/watchdog/nic7018_wdt.c:213:17: note: in expansion of macro 'outb'
     213 |                 outb(LOCK, wdt->io_base + WDT_REG_LOCK);
         |                 ^~~~


vim +/_outb +596 include/asm-generic/io.h

3f7e212df82ca0 Arnd Bergmann   2009-05-13  534  
9216efafc52ff9 Thierry Reding  2014-10-01  535  /*
9216efafc52ff9 Thierry Reding  2014-10-01  536   * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
9216efafc52ff9 Thierry Reding  2014-10-01  537   * implemented on hardware that needs an additional delay for I/O accesses to
9216efafc52ff9 Thierry Reding  2014-10-01  538   * take effect.
9216efafc52ff9 Thierry Reding  2014-10-01  539   */
9216efafc52ff9 Thierry Reding  2014-10-01  540  
f009c89df79abe John Garry      2020-03-28  541  #if !defined(inb) && !defined(_inb)
f009c89df79abe John Garry      2020-03-28 @542  #define _inb _inb
6f043e75744596 Niklas Schnelle 2024-10-24  543  #ifdef CONFIG_HAS_IOPORT
214ba3584b2e2c Stafford Horne  2020-07-26  544  static inline u8 _inb(unsigned long addr)
9216efafc52ff9 Thierry Reding  2014-10-01  545  {
87fe2d543f8173 Sinan Kaya      2018-04-05  546  	u8 val;
87fe2d543f8173 Sinan Kaya      2018-04-05  547  
87fe2d543f8173 Sinan Kaya      2018-04-05  548  	__io_pbr();
87fe2d543f8173 Sinan Kaya      2018-04-05  549  	val = __raw_readb(PCI_IOBASE + addr);
abbbbc83a210e9 Will Deacon     2019-02-22  550  	__io_par(val);
87fe2d543f8173 Sinan Kaya      2018-04-05  551  	return val;
9216efafc52ff9 Thierry Reding  2014-10-01  552  }
6f043e75744596 Niklas Schnelle 2024-10-24  553  #else
6f043e75744596 Niklas Schnelle 2024-10-24  554  u8 _inb(unsigned long addr)
6f043e75744596 Niklas Schnelle 2024-10-24  555  	__compiletime_error("inb()) requires CONFIG_HAS_IOPORT");
6f043e75744596 Niklas Schnelle 2024-10-24  556  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  557  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  558  
f009c89df79abe John Garry      2020-03-28  559  #if !defined(inw) && !defined(_inw)
f009c89df79abe John Garry      2020-03-28  560  #define _inw _inw
6f043e75744596 Niklas Schnelle 2024-10-24  561  #ifdef CONFIG_HAS_IOPORT
f009c89df79abe John Garry      2020-03-28  562  static inline u16 _inw(unsigned long addr)
9216efafc52ff9 Thierry Reding  2014-10-01  563  {
87fe2d543f8173 Sinan Kaya      2018-04-05  564  	u16 val;
87fe2d543f8173 Sinan Kaya      2018-04-05  565  
87fe2d543f8173 Sinan Kaya      2018-04-05  566  	__io_pbr();
c1d55d50139bea Stafford Horne  2020-07-29  567  	val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
abbbbc83a210e9 Will Deacon     2019-02-22  568  	__io_par(val);
87fe2d543f8173 Sinan Kaya      2018-04-05  569  	return val;
9216efafc52ff9 Thierry Reding  2014-10-01  570  }
6f043e75744596 Niklas Schnelle 2024-10-24  571  #else
6f043e75744596 Niklas Schnelle 2024-10-24  572  u16 _inw(unsigned long addr)
6f043e75744596 Niklas Schnelle 2024-10-24  573  	__compiletime_error("inw() requires CONFIG_HAS_IOPORT");
6f043e75744596 Niklas Schnelle 2024-10-24  574  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  575  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  576  
f009c89df79abe John Garry      2020-03-28  577  #if !defined(inl) && !defined(_inl)
f009c89df79abe John Garry      2020-03-28  578  #define _inl _inl
6f043e75744596 Niklas Schnelle 2024-10-24  579  #ifdef CONFIG_HAS_IOPORT
214ba3584b2e2c Stafford Horne  2020-07-26  580  static inline u32 _inl(unsigned long addr)
9216efafc52ff9 Thierry Reding  2014-10-01  581  {
87fe2d543f8173 Sinan Kaya      2018-04-05  582  	u32 val;
87fe2d543f8173 Sinan Kaya      2018-04-05  583  
87fe2d543f8173 Sinan Kaya      2018-04-05  584  	__io_pbr();
c1d55d50139bea Stafford Horne  2020-07-29  585  	val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
abbbbc83a210e9 Will Deacon     2019-02-22  586  	__io_par(val);
87fe2d543f8173 Sinan Kaya      2018-04-05  587  	return val;
9216efafc52ff9 Thierry Reding  2014-10-01  588  }
6f043e75744596 Niklas Schnelle 2024-10-24  589  #else
6f043e75744596 Niklas Schnelle 2024-10-24  590  u32 _inl(unsigned long addr)
6f043e75744596 Niklas Schnelle 2024-10-24  591  	__compiletime_error("inl() requires CONFIG_HAS_IOPORT");
6f043e75744596 Niklas Schnelle 2024-10-24  592  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  593  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  594  
f009c89df79abe John Garry      2020-03-28  595  #if !defined(outb) && !defined(_outb)
f009c89df79abe John Garry      2020-03-28 @596  #define _outb _outb
6f043e75744596 Niklas Schnelle 2024-10-24  597  #ifdef CONFIG_HAS_IOPORT
f009c89df79abe John Garry      2020-03-28  598  static inline void _outb(u8 value, unsigned long addr)
9216efafc52ff9 Thierry Reding  2014-10-01  599  {
a7851aa54c0cdd Sinan Kaya      2018-04-05  600  	__io_pbw();
a7851aa54c0cdd Sinan Kaya      2018-04-05  601  	__raw_writeb(value, PCI_IOBASE + addr);
a7851aa54c0cdd Sinan Kaya      2018-04-05  602  	__io_paw();
9216efafc52ff9 Thierry Reding  2014-10-01  603  }
6f043e75744596 Niklas Schnelle 2024-10-24  604  #else
6f043e75744596 Niklas Schnelle 2024-10-24  605  void _outb(u8 value, unsigned long addr)
6f043e75744596 Niklas Schnelle 2024-10-24  606  	__compiletime_error("outb() requires CONFIG_HAS_IOPORT");
6f043e75744596 Niklas Schnelle 2024-10-24  607  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  608  #endif
9216efafc52ff9 Thierry Reding  2014-10-01  609
kernel test robot Feb. 26, 2025, 12:49 a.m. UTC | #3
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.14-rc4 next-20250225]
[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-nic7018_wdt-tidy-up-ACPI-ID-table/20250225-180908
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20250225095804.360899-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] watchdog: nic7018_wdt: tidy up ACPI ID table
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250226/202502260805.jPVNYTZ0-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250226/202502260805.jPVNYTZ0-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502260805.jPVNYTZ0-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/watchdog/nic7018_wdt.c:7:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/watchdog/nic7018_wdt.c:209:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     209 |         outb(UNLOCK, wdt->io_base + WDT_REG_LOCK);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:213:3: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     213 |                 outb(LOCK, wdt->io_base + WDT_REG_LOCK);
         |                 ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:229:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     229 |         outb(LOCK, wdt->io_base + WDT_REG_LOCK);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:96:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
      96 |         outb(counter << 4 | config->divider,
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
>> drivers/watchdog/nic7018_wdt.c:112:12: error: call to '_inb' declared with 'error' attribute: inb()) requires CONFIG_HAS_IOPORT
     112 |         control = inb(wdt->io_base + WDT_RELOAD_CTRL);
         |                   ^
   include/asm-generic/io.h:643:13: note: expanded from macro 'inb'
     643 | #define inb _inb
         |             ^
   include/asm-generic/io.h:542:14: note: expanded from macro '_inb'
     542 | #define _inb _inb
         |              ^
   drivers/watchdog/nic7018_wdt.c:113:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     113 |         outb(control | WDT_RELOAD_PORT_EN, wdt->io_base + WDT_RELOAD_CTRL);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:115:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     115 |         outb(1, wdt->io_base + WDT_RELOAD_PORT);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:117:12: error: call to '_inb' declared with 'error' attribute: inb()) requires CONFIG_HAS_IOPORT
     117 |         control = inb(wdt->io_base + WDT_CTRL);
         |                   ^
   include/asm-generic/io.h:643:13: note: expanded from macro 'inb'
     643 | #define inb _inb
         |             ^
   include/asm-generic/io.h:542:14: note: expanded from macro '_inb'
     542 | #define _inb _inb
         |              ^
   drivers/watchdog/nic7018_wdt.c:118:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     118 |         outb(control | WDT_CTRL_RESET_EN, wdt->io_base + WDT_CTRL);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:127:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     127 |         outb(0, wdt->io_base + WDT_CTRL);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:128:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     128 |         outb(0, wdt->io_base + WDT_RELOAD_CTRL);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:129:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     129 |         outb(0xF0, wdt->io_base + WDT_PRESET_PRESCALE);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:138:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
     138 |         outb(1, wdt->io_base + WDT_RELOAD_PORT);
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:96:2: error: call to '_outb' declared with 'error' attribute: outb() requires CONFIG_HAS_IOPORT
      96 |         outb(counter << 4 | config->divider,
         |         ^
   include/asm-generic/io.h:655:14: note: expanded from macro 'outb'
     655 | #define outb _outb
         |              ^
   include/asm-generic/io.h:596:15: note: expanded from macro '_outb'
     596 | #define _outb _outb
         |               ^
   drivers/watchdog/nic7018_wdt.c:148:10: error: call to '_inb' declared with 'error' attribute: inb()) requires CONFIG_HAS_IOPORT
     148 |         count = inb(wdt->io_base + WDT_COUNT) & 0xF;
         |                 ^
   include/asm-generic/io.h:643:13: note: expanded from macro 'inb'
     643 | #define inb _inb
         |             ^
   include/asm-generic/io.h:542:14: note: expanded from macro '_inb'
     542 | #define _inb _inb
         |              ^
   3 warnings and 15 errors generated.


vim +209 drivers/watchdog/nic7018_wdt.c

98078ca34a0a71 Hui Chun Ong 2016-12-28  104  
98078ca34a0a71 Hui Chun Ong 2016-12-28  105  static int nic7018_start(struct watchdog_device *wdd)
98078ca34a0a71 Hui Chun Ong 2016-12-28  106  {
98078ca34a0a71 Hui Chun Ong 2016-12-28  107  	struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd);
98078ca34a0a71 Hui Chun Ong 2016-12-28  108  	u8 control;
98078ca34a0a71 Hui Chun Ong 2016-12-28  109  
98078ca34a0a71 Hui Chun Ong 2016-12-28  110  	nic7018_set_timeout(wdd, wdd->timeout);
98078ca34a0a71 Hui Chun Ong 2016-12-28  111  
98078ca34a0a71 Hui Chun Ong 2016-12-28 @112  	control = inb(wdt->io_base + WDT_RELOAD_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  113  	outb(control | WDT_RELOAD_PORT_EN, wdt->io_base + WDT_RELOAD_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  114  
98078ca34a0a71 Hui Chun Ong 2016-12-28  115  	outb(1, wdt->io_base + WDT_RELOAD_PORT);
98078ca34a0a71 Hui Chun Ong 2016-12-28  116  
98078ca34a0a71 Hui Chun Ong 2016-12-28  117  	control = inb(wdt->io_base + WDT_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  118  	outb(control | WDT_CTRL_RESET_EN, wdt->io_base + WDT_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  119  
98078ca34a0a71 Hui Chun Ong 2016-12-28  120  	return 0;
98078ca34a0a71 Hui Chun Ong 2016-12-28  121  }
98078ca34a0a71 Hui Chun Ong 2016-12-28  122  
98078ca34a0a71 Hui Chun Ong 2016-12-28  123  static int nic7018_stop(struct watchdog_device *wdd)
98078ca34a0a71 Hui Chun Ong 2016-12-28  124  {
98078ca34a0a71 Hui Chun Ong 2016-12-28  125  	struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd);
98078ca34a0a71 Hui Chun Ong 2016-12-28  126  
98078ca34a0a71 Hui Chun Ong 2016-12-28  127  	outb(0, wdt->io_base + WDT_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  128  	outb(0, wdt->io_base + WDT_RELOAD_CTRL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  129  	outb(0xF0, wdt->io_base + WDT_PRESET_PRESCALE);
98078ca34a0a71 Hui Chun Ong 2016-12-28  130  
98078ca34a0a71 Hui Chun Ong 2016-12-28  131  	return 0;
98078ca34a0a71 Hui Chun Ong 2016-12-28  132  }
98078ca34a0a71 Hui Chun Ong 2016-12-28  133  
98078ca34a0a71 Hui Chun Ong 2016-12-28  134  static int nic7018_ping(struct watchdog_device *wdd)
98078ca34a0a71 Hui Chun Ong 2016-12-28  135  {
98078ca34a0a71 Hui Chun Ong 2016-12-28  136  	struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd);
98078ca34a0a71 Hui Chun Ong 2016-12-28  137  
98078ca34a0a71 Hui Chun Ong 2016-12-28  138  	outb(1, wdt->io_base + WDT_RELOAD_PORT);
98078ca34a0a71 Hui Chun Ong 2016-12-28  139  
98078ca34a0a71 Hui Chun Ong 2016-12-28  140  	return 0;
98078ca34a0a71 Hui Chun Ong 2016-12-28  141  }
98078ca34a0a71 Hui Chun Ong 2016-12-28  142  
98078ca34a0a71 Hui Chun Ong 2016-12-28  143  static unsigned int nic7018_get_timeleft(struct watchdog_device *wdd)
98078ca34a0a71 Hui Chun Ong 2016-12-28  144  {
98078ca34a0a71 Hui Chun Ong 2016-12-28  145  	struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd);
98078ca34a0a71 Hui Chun Ong 2016-12-28  146  	u8 count;
98078ca34a0a71 Hui Chun Ong 2016-12-28  147  
98078ca34a0a71 Hui Chun Ong 2016-12-28  148  	count = inb(wdt->io_base + WDT_COUNT) & 0xF;
98078ca34a0a71 Hui Chun Ong 2016-12-28  149  	if (!count)
98078ca34a0a71 Hui Chun Ong 2016-12-28  150  		return 0;
98078ca34a0a71 Hui Chun Ong 2016-12-28  151  
98078ca34a0a71 Hui Chun Ong 2016-12-28  152  	return nic7018_timeout(wdt->period, count);
98078ca34a0a71 Hui Chun Ong 2016-12-28  153  }
98078ca34a0a71 Hui Chun Ong 2016-12-28  154  
98078ca34a0a71 Hui Chun Ong 2016-12-28  155  static const struct watchdog_info nic7018_wdd_info = {
98078ca34a0a71 Hui Chun Ong 2016-12-28  156  	.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
98078ca34a0a71 Hui Chun Ong 2016-12-28  157  	.identity = "NIC7018 Watchdog",
98078ca34a0a71 Hui Chun Ong 2016-12-28  158  };
98078ca34a0a71 Hui Chun Ong 2016-12-28  159  
98078ca34a0a71 Hui Chun Ong 2016-12-28  160  static const struct watchdog_ops nic7018_wdd_ops = {
98078ca34a0a71 Hui Chun Ong 2016-12-28  161  	.owner = THIS_MODULE,
98078ca34a0a71 Hui Chun Ong 2016-12-28  162  	.start = nic7018_start,
98078ca34a0a71 Hui Chun Ong 2016-12-28  163  	.stop = nic7018_stop,
98078ca34a0a71 Hui Chun Ong 2016-12-28  164  	.ping = nic7018_ping,
98078ca34a0a71 Hui Chun Ong 2016-12-28  165  	.set_timeout = nic7018_set_timeout,
98078ca34a0a71 Hui Chun Ong 2016-12-28  166  	.get_timeleft = nic7018_get_timeleft,
98078ca34a0a71 Hui Chun Ong 2016-12-28  167  };
98078ca34a0a71 Hui Chun Ong 2016-12-28  168  
98078ca34a0a71 Hui Chun Ong 2016-12-28  169  static int nic7018_probe(struct platform_device *pdev)
98078ca34a0a71 Hui Chun Ong 2016-12-28  170  {
98078ca34a0a71 Hui Chun Ong 2016-12-28  171  	struct device *dev = &pdev->dev;
98078ca34a0a71 Hui Chun Ong 2016-12-28  172  	struct watchdog_device *wdd;
98078ca34a0a71 Hui Chun Ong 2016-12-28  173  	struct nic7018_wdt *wdt;
98078ca34a0a71 Hui Chun Ong 2016-12-28  174  	struct resource *io_rc;
98078ca34a0a71 Hui Chun Ong 2016-12-28  175  	int ret;
98078ca34a0a71 Hui Chun Ong 2016-12-28  176  
98078ca34a0a71 Hui Chun Ong 2016-12-28  177  	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
98078ca34a0a71 Hui Chun Ong 2016-12-28  178  	if (!wdt)
98078ca34a0a71 Hui Chun Ong 2016-12-28  179  		return -ENOMEM;
98078ca34a0a71 Hui Chun Ong 2016-12-28  180  
98078ca34a0a71 Hui Chun Ong 2016-12-28  181  	platform_set_drvdata(pdev, wdt);
98078ca34a0a71 Hui Chun Ong 2016-12-28  182  
98078ca34a0a71 Hui Chun Ong 2016-12-28  183  	io_rc = platform_get_resource(pdev, IORESOURCE_IO, 0);
98078ca34a0a71 Hui Chun Ong 2016-12-28  184  	if (!io_rc) {
98078ca34a0a71 Hui Chun Ong 2016-12-28  185  		dev_err(dev, "missing IO resources\n");
98078ca34a0a71 Hui Chun Ong 2016-12-28  186  		return -EINVAL;
98078ca34a0a71 Hui Chun Ong 2016-12-28  187  	}
98078ca34a0a71 Hui Chun Ong 2016-12-28  188  
98078ca34a0a71 Hui Chun Ong 2016-12-28  189  	if (!devm_request_region(dev, io_rc->start, resource_size(io_rc),
98078ca34a0a71 Hui Chun Ong 2016-12-28  190  				 KBUILD_MODNAME)) {
98078ca34a0a71 Hui Chun Ong 2016-12-28  191  		dev_err(dev, "failed to get IO region\n");
98078ca34a0a71 Hui Chun Ong 2016-12-28  192  		return -EBUSY;
98078ca34a0a71 Hui Chun Ong 2016-12-28  193  	}
98078ca34a0a71 Hui Chun Ong 2016-12-28  194  
98078ca34a0a71 Hui Chun Ong 2016-12-28  195  	wdt->io_base = io_rc->start;
98078ca34a0a71 Hui Chun Ong 2016-12-28  196  	wdd = &wdt->wdd;
98078ca34a0a71 Hui Chun Ong 2016-12-28  197  	wdd->info = &nic7018_wdd_info;
98078ca34a0a71 Hui Chun Ong 2016-12-28  198  	wdd->ops = &nic7018_wdd_ops;
98078ca34a0a71 Hui Chun Ong 2016-12-28  199  	wdd->min_timeout = WDT_MIN_TIMEOUT;
98078ca34a0a71 Hui Chun Ong 2016-12-28  200  	wdd->max_timeout = WDT_MAX_TIMEOUT;
98078ca34a0a71 Hui Chun Ong 2016-12-28  201  	wdd->timeout = WDT_DEFAULT_TIMEOUT;
98078ca34a0a71 Hui Chun Ong 2016-12-28  202  	wdd->parent = dev;
98078ca34a0a71 Hui Chun Ong 2016-12-28  203  
98078ca34a0a71 Hui Chun Ong 2016-12-28  204  	watchdog_set_drvdata(wdd, wdt);
98078ca34a0a71 Hui Chun Ong 2016-12-28  205  	watchdog_set_nowayout(wdd, nowayout);
14fad5d98d9043 Wolfram Sang 2019-04-19  206  	watchdog_init_timeout(wdd, timeout, dev);
98078ca34a0a71 Hui Chun Ong 2016-12-28  207  
98078ca34a0a71 Hui Chun Ong 2016-12-28  208  	/* Unlock WDT register */
98078ca34a0a71 Hui Chun Ong 2016-12-28 @209  	outb(UNLOCK, wdt->io_base + WDT_REG_LOCK);
98078ca34a0a71 Hui Chun Ong 2016-12-28  210  
98078ca34a0a71 Hui Chun Ong 2016-12-28  211  	ret = watchdog_register_device(wdd);
98078ca34a0a71 Hui Chun Ong 2016-12-28  212  	if (ret) {
98078ca34a0a71 Hui Chun Ong 2016-12-28  213  		outb(LOCK, wdt->io_base + WDT_REG_LOCK);
98078ca34a0a71 Hui Chun Ong 2016-12-28  214  		return ret;
98078ca34a0a71 Hui Chun Ong 2016-12-28  215  	}
98078ca34a0a71 Hui Chun Ong 2016-12-28  216  
98078ca34a0a71 Hui Chun Ong 2016-12-28  217  	dev_dbg(dev, "io_base=0x%04X, timeout=%d, nowayout=%d\n",
98078ca34a0a71 Hui Chun Ong 2016-12-28  218  		wdt->io_base, timeout, nowayout);
98078ca34a0a71 Hui Chun Ong 2016-12-28  219  	return 0;
98078ca34a0a71 Hui Chun Ong 2016-12-28  220  }
98078ca34a0a71 Hui Chun Ong 2016-12-28  221
diff mbox series

Patch

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f81705f8539a..ca9e108c44e6 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1730,7 +1730,8 @@  config NI903X_WDT
 
 config NIC7018_WDT
 	tristate "NIC7018 Watchdog"
-	depends on X86 && ACPI
+	depends on HAS_IOMEM
+	depends on ACPI || COMPILE_TEST
 	select WATCHDOG_CORE
 	help
 	  Support for National Instruments NIC7018 Watchdog.
diff --git a/drivers/watchdog/nic7018_wdt.c b/drivers/watchdog/nic7018_wdt.c
index 44982b37ba6f..44b5298f599a 100644
--- a/drivers/watchdog/nic7018_wdt.c
+++ b/drivers/watchdog/nic7018_wdt.c
@@ -3,12 +3,13 @@ 
  * Copyright (C) 2016 National Instruments Corp.
  */
 
-#include <linux/acpi.h>
 #include <linux/bitops.h>
 #include <linux/device.h>
 #include <linux/io.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/types.h>
 #include <linux/watchdog.h>
 
 #define LOCK			0xA5
@@ -229,8 +230,8 @@  static void nic7018_remove(struct platform_device *pdev)
 }
 
 static const struct acpi_device_id nic7018_device_ids[] = {
-	{"NIC7018", 0},
-	{"", 0},
+	{ "NIC7018" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, nic7018_device_ids);
 
@@ -239,7 +240,7 @@  static struct platform_driver watchdog_driver = {
 	.remove = nic7018_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
-		.acpi_match_table = ACPI_PTR(nic7018_device_ids),
+		.acpi_match_table = nic7018_device_ids,
 	},
 };