Merge tag 'linux-watchdog-5.2-rc1' of git://www.linux-watchdog.org/linux-watchdog
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 May 2019 13:20:42 +0000 (09:20 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 May 2019 13:20:42 +0000 (09:20 -0400)
Pull watchdog updates from Wim Van Sebroeck:

 - a new watchdog driver for the ROHM BD70528 watchdog block

 - a new watchdog driver for the i.MX system controller watchdog

 - conversions to use device managed functions and other improvements

 - refactor watchdog_init_timeout

 - make watchdog core configurable as module

 - pretimeout governors improvements

 - a lot of other fixes

* tag 'linux-watchdog-5.2-rc1' of git://www.linux-watchdog.org/linux-watchdog: (114 commits)
  watchdog: Enforce that at least one pretimeout governor is enabled
  watchdog: stm32: add dynamic prescaler support
  watchdog: Improve Kconfig entry ordering and dependencies
  watchdog: npcm: Enable modular builds
  watchdog: Make watchdog core configurable as module
  watchdog: Move pretimeout governor configuration up
  watchdog: Use depends instead of select for pretimeout governors
  watchdog: rtd119x: drop unused module.h include
  watchdog: intel_scu: make it explicitly non-modular
  watchdog: coh901327: make it explicitly non-modular
  watchdog: ziirave_wdt: drop warning after calling watchdog_init_timeout
  watchdog: xen_wdt: drop warning after calling watchdog_init_timeout
  watchdog: stm32_iwdg: drop warning after calling watchdog_init_timeout
  watchdog: st_lpc_wdt: drop warning after calling watchdog_init_timeout
  watchdog: sp5100_tco: drop warning after calling watchdog_init_timeout
  watchdog: renesas_wdt: drop warning after calling watchdog_init_timeout
  watchdog: nic7018_wdt: drop warning after calling watchdog_init_timeout
  watchdog: ni903x_wdt: drop warning after calling watchdog_init_timeout
  watchdog: imx_sc_wdt: drop warning after calling watchdog_init_timeout
  watchdog: i6300esb: drop warning after calling watchdog_init_timeout
  ...

1  2 
drivers/watchdog/alim7101_wdt.c
drivers/watchdog/ath79_wdt.c
drivers/watchdog/f71808e_wdt.c
drivers/watchdog/intel_scu_watchdog.c
drivers/watchdog/machzwd.c
drivers/watchdog/nuc900_wdt.c
drivers/watchdog/sb_wdog.c
drivers/watchdog/sbsa_gwdt.c

index 7e9884960eb9401949fd77fe9f8f3f02bd6d6e86,f5ada07e9202c040f8970835507db301c7d80f1d..689b8a0593c1ad2ac8caaba1403ebb53c8a922d0
@@@ -214,7 -214,7 +214,7 @@@ static int fop_open(struct inode *inode
                return -EBUSY;
        /* Good, fire up the show */
        wdt_startup();
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int fop_close(struct inode *inode, struct file *file)
@@@ -277,8 -277,8 +277,8 @@@ static long fop_ioctl(struct file *file
                        return -EINVAL;
                timeout = new_timeout;
                wdt_keepalive();
-               /* Fall through */
        }
+               /* Fall through */
        case WDIOC_GETTIMEOUT:
                return put_user(timeout, p);
        default:
index 4f56b63f96910c3fa3b8b53b513b096f46bb8322,5d66c8ec9a7db9d70372ea1216ec46997bab935b..02234c254b10644850b9e838176463f9d85ac0c5
@@@ -132,7 -132,7 +132,7 @@@ static int ath79_wdt_open(struct inode 
        clear_bit(WDT_FLAGS_EXPECT_CLOSE, &wdt_flags);
        ath79_wdt_enable();
  
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int ath79_wdt_release(struct inode *inode, struct file *file)
@@@ -250,15 -250,13 +250,13 @@@ static struct miscdevice ath79_wdt_misc
  
  static int ath79_wdt_probe(struct platform_device *pdev)
  {
-       struct resource *res;
        u32 ctrl;
        int err;
  
        if (wdt_base)
                return -EBUSY;
  
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       wdt_base = devm_ioremap_resource(&pdev->dev, res);
+       wdt_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(wdt_base))
                return PTR_ERR(wdt_base);
  
index 021c6ace9462744aba25ddd8f77dea6b3d16fb7d,afd1446241b3c98b1ffdbd0dd9d462c0be957d78..041172e6c4697de83df9bb636d966a1452a9f6f5
@@@ -338,8 -338,11 +338,11 @@@ static int f71862fg_pin_configure(unsig
  
  static int watchdog_start(void)
  {
+       int err;
+       u8 tmp;
        /* Make sure we don't die as soon as the watchdog is enabled below */
-       int err = watchdog_keepalive();
+       err = watchdog_keepalive();
        if (err)
                return err;
  
                break;
  
        case f81866:
-               /* Set pin 70 to WDTRST# */
-               superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL,
-                                 BIT(3) | BIT(0));
-               superio_set_bit(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL,
-                               BIT(2));
                /*
                 * GPIO1 Control Register when 27h BIT3:2 = 01 & BIT0 = 0.
                 * The PIN 70(GPIO15/WDTRST) is controlled by 2Ch:
                 *     BIT5: 0 -> WDTRST#
                 *           1 -> GPIO15
                 */
-               superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_GPIO1,
-                                 BIT(5));
+               tmp = superio_inb(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL);
+               tmp &= ~(BIT(3) | BIT(0));
+               tmp |= BIT(2);
+               superio_outb(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL, tmp);
+               superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_GPIO1, 5);
                break;
  
        default:
@@@ -525,7 -527,7 +527,7 @@@ static int watchdog_open(struct inode *
                __module_get(THIS_MODULE);
  
        watchdog.expect_close = 0;
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int watchdog_release(struct inode *inode, struct file *file)
index 3181a72c7ddf3f736a05ae0fb0507f7a7bb1b7f9,94dbcc1d3c2b3b902b46a420cde895898bca4b23..f7baf75d38c0ebfd3fb7546612aa838f1848b037
@@@ -25,7 -25,6 +25,6 @@@
  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  
  #include <linux/compiler.h>
- #include <linux/module.h>
  #include <linux/kernel.h>
  #include <linux/moduleparam.h>
  #include <linux/types.h>
@@@ -224,7 -223,7 +223,7 @@@ static int intel_scu_set_heartbeat(u32 
                 watchdog_device.timer_tbl_ptr->freq_hz);
        pr_debug("set_heartbeat: timer_set is %x (hex)\n",
                 watchdog_device.timer_set);
-       pr_debug("set_hearbeat: timer_margin is %x (hex)\n", timer_margin);
+       pr_debug("set_heartbeat: timer_margin is %x (hex)\n", timer_margin);
        pr_debug("set_heartbeat: threshold is %x (hex)\n",
                 watchdog_device.threshold);
        pr_debug("set_heartbeat: soft_threshold is %x (hex)\n",
@@@ -304,7 -303,7 +303,7 @@@ static int intel_scu_open(struct inode 
        if (watchdog_device.driver_closed)
                return -EPERM;
  
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int intel_scu_release(struct inode *inode, struct file *file)
@@@ -545,21 -544,4 +544,4 @@@ register_reboot_error
        iounmap(watchdog_device.timer_load_count_addr);
        return ret;
  }
- static void __exit intel_scu_watchdog_exit(void)
- {
-       misc_deregister(&watchdog_device.miscdev);
-       unregister_reboot_notifier(&watchdog_device.intel_scu_notifier);
-       /* disable the timer */
-       iowrite32(0x00000002, watchdog_device.timer_control_addr);
-       iounmap(watchdog_device.timer_load_count_addr);
- }
  late_initcall(intel_scu_watchdog_init);
- module_exit(intel_scu_watchdog_exit);
- MODULE_AUTHOR("Intel Corporation");
- MODULE_DESCRIPTION("Intel SCU Watchdog Device Driver");
- MODULE_LICENSE("GPL");
- MODULE_VERSION(WDT_VER);
index 53759415cf06e9890315e0a0a63245a94e9ff93f,c2c322dd1d908a74d4837eb1bb5925eed51d1195..c0c9e948adbcd48bd91d7e77110203113796d871
@@@ -177,6 -177,7 +177,7 @@@ static inline void zf_set_timer(unsigne
        switch (n) {
        case WD1:
                zf_writew(COUNTER_1, new);
+               /* fall through */
        case WD2:
                zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
        default:
@@@ -318,7 -319,7 +319,7 @@@ static long zf_ioctl(struct file *file
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
        case WDIOC_KEEPALIVE:
-               zf_ping(0);
+               zf_ping(NULL);
                break;
        default:
                return -ENOTTY;
@@@ -333,7 -334,7 +334,7 @@@ static int zf_open(struct inode *inode
        if (nowayout)
                __module_get(THIS_MODULE);
        zf_timer_on();
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int zf_close(struct inode *inode, struct file *file)
index 8a36350bab7bbdd1ef616162cecf5add2c1986e3,74e99eac90b94ecaa89c23c82a700c04ac52c978..f36eae34e848049401ec29929d0010038e3ff81d
@@@ -131,7 -131,7 +131,7 @@@ static int nuc900_wdt_open(struct inod
  
        nuc900_wdt_start();
  
 -      return nonseekable_open(inode, file);
 +      return stream_open(inode, file);
  }
  
  static int nuc900_wdt_close(struct inode *inode, struct file *file)
@@@ -242,7 -242,6 +242,6 @@@ static struct miscdevice nuc900wdt_misc
  
  static int nuc900wdt_probe(struct platform_device *pdev)
  {
-       struct resource *res;
        int ret = 0;
  
        nuc900_wdt = devm_kzalloc(&pdev->dev, sizeof(*nuc900_wdt),
  
        spin_lock_init(&nuc900_wdt->wdt_lock);
  
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       nuc900_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
+       nuc900_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(nuc900_wdt->wdt_base))
                return PTR_ERR(nuc900_wdt->wdt_base);
  
index 0692d42e5c67058d7f441611387200aa99cea3ad,8264fced1959fd5dff1a2aa91737a0e3dd941109..5a6ced7a7e8f80a95ebc0ecba3e70c793caea701
@@@ -67,7 -67,7 +67,7 @@@ static DEFINE_SPINLOCK(sbwd_lock)
   *
   * wdog is the iomem address of the cfg register
   */
- void sbwdog_set(char __iomem *wdog, unsigned long t)
static void sbwdog_set(char __iomem *wdog, unsigned long t)
  {
        spin_lock(&sbwd_lock);
        __raw_writeb(0, wdog);
@@@ -81,7 -81,7 +81,7 @@@
   *
   * wdog is the iomem address of the cfg register
   */
- void sbwdog_pet(char __iomem *wdog)
static void sbwdog_pet(char __iomem *wdog)
  {
        spin_lock(&sbwd_lock);
        __raw_writeb(__raw_readb(wdog) | 1, wdog);
@@@ -105,7 -105,7 +105,7 @@@ static const struct watchdog_info iden
   */
  static int sbwdog_open(struct inode *inode, struct file *file)
  {
 -      nonseekable_open(inode, file);
 +      stream_open(inode, file);
        if (test_and_set_bit(0, &sbwdog_gate))
                return -EBUSY;
        __module_get(THIS_MODULE);
index e221e47396ab72ddd8615ce81c8c6f7d9247d941,e17af8939c934e0f7a60db3c2b1fe7a1a35810fa..3219422f67a962218a2a5e7ceff78abfae8531cc
@@@ -161,7 -161,7 +161,7 @@@ static unsigned int sbsa_gwdt_get_timel
                timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR);
  
        timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) -
 -                  arch_counter_get_cntvct();
 +                  arch_timer_read_counter();
  
        do_div(timeleft, gwdt->clk);
  
@@@ -231,7 -231,6 +231,6 @@@ static int sbsa_gwdt_probe(struct platf
        struct device *dev = &pdev->dev;
        struct watchdog_device *wdd;
        struct sbsa_gwdt *gwdt;
-       struct resource *res;
        int ret, irq;
        u32 status;
  
                return -ENOMEM;
        platform_set_drvdata(pdev, gwdt);
  
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       cf_base = devm_ioremap_resource(dev, res);
+       cf_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(cf_base))
                return PTR_ERR(cf_base);
  
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       rf_base = devm_ioremap_resource(dev, res);
+       rf_base = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(rf_base))
                return PTR_ERR(rf_base);
  
         */
        sbsa_gwdt_set_timeout(wdd, wdd->timeout);
  
-       ret = watchdog_register_device(wdd);
+       watchdog_stop_on_reboot(wdd);
+       ret = devm_watchdog_register_device(dev, wdd);
        if (ret)
                return ret;
  
        return 0;
  }
  
- static void sbsa_gwdt_shutdown(struct platform_device *pdev)
- {
-       struct sbsa_gwdt *gwdt = platform_get_drvdata(pdev);
-       sbsa_gwdt_stop(&gwdt->wdd);
- }
- static int sbsa_gwdt_remove(struct platform_device *pdev)
- {
-       struct sbsa_gwdt *gwdt = platform_get_drvdata(pdev);
-       watchdog_unregister_device(&gwdt->wdd);
-       return 0;
- }
  /* Disable watchdog if it is active during suspend */
  static int __maybe_unused sbsa_gwdt_suspend(struct device *dev)
  {
@@@ -385,8 -367,6 +367,6 @@@ static struct platform_driver sbsa_gwdt
                .of_match_table = sbsa_gwdt_of_match,
        },
        .probe = sbsa_gwdt_probe,
-       .remove = sbsa_gwdt_remove,
-       .shutdown = sbsa_gwdt_shutdown,
        .id_table = sbsa_gwdt_pdev_match,
  };