^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * drivers/char/watchdog/iop_wdt.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * WDT driver for Intel I/O Processors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2005, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Based on ixp4xx driver, Copyright 2004 (c) MontaVista, Software, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Curt E Bruns <curt.e.bruns@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Peter Milne <peter.milne@d-tacq.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Dan Williams <dan.j.williams@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/miscdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/watchdog.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <mach/hardware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static bool nowayout = WATCHDOG_NOWAYOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static unsigned long wdt_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static unsigned long boot_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static DEFINE_SPINLOCK(wdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define WDT_IN_USE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define WDT_OK_TO_CLOSE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define WDT_ENABLED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static unsigned long iop_watchdog_timeout(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return (0xffffffffUL / get_iop_tick_rate());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * wdt_supports_disable - determine if we are accessing a iop13xx watchdog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * or iop3xx by whether it has a disable command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static int wdt_supports_disable(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int can_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (IOP_WDTCR_EN_ARM != IOP_WDTCR_DIS_ARM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) can_disable = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) can_disable = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return can_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static void wdt_enable(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* Arm and enable the Timer to starting counting down from 0xFFFF.FFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * Takes approx. 10.7s to timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) spin_lock(&wdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) write_wdtcr(IOP_WDTCR_EN_ARM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) write_wdtcr(IOP_WDTCR_EN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) spin_unlock(&wdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* returns 0 if the timer was successfully disabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static int wdt_disable(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* Stop Counting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) if (wdt_supports_disable()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) spin_lock(&wdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) write_wdtcr(IOP_WDTCR_DIS_ARM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) write_wdtcr(IOP_WDTCR_DIS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) clear_bit(WDT_ENABLED, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) spin_unlock(&wdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) pr_info("Disabled\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static int iop_wdt_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (test_and_set_bit(WDT_IN_USE, &wdt_status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) wdt_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) set_bit(WDT_ENABLED, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) return stream_open(inode, file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) if (len) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) if (!nowayout) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) size_t i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) for (i = 0; i != len; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) char c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if (get_user(c, data + i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) if (c == 'V')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) set_bit(WDT_OK_TO_CLOSE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) wdt_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static const struct watchdog_info ident = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) .identity = "iop watchdog",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static long iop_wdt_ioctl(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) unsigned int cmd, unsigned long arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int ret = -ENOTTY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int __user *argp = (int __user *)arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) switch (cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) case WDIOC_GETSUPPORT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) if (copy_to_user(argp, &ident, sizeof(ident)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) ret = -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) case WDIOC_GETSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ret = put_user(0, argp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) case WDIOC_GETBOOTSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) ret = put_user(boot_status, argp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) case WDIOC_SETOPTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (get_user(options, (int *)arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (options & WDIOS_DISABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (!nowayout) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (wdt_disable() == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) set_bit(WDT_OK_TO_CLOSE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) ret = -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (options & WDIOS_ENABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) wdt_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) case WDIOC_KEEPALIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) wdt_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) case WDIOC_GETTIMEOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) ret = put_user(iop_watchdog_timeout(), argp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static int iop_wdt_release(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int state = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (test_bit(WDT_ENABLED, &wdt_status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) state = wdt_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) /* if the timer is not disabled reload and notify that we are still
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * going down
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) if (state != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) wdt_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) pr_crit("Device closed unexpectedly - reset in %lu seconds\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) iop_watchdog_timeout());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) clear_bit(WDT_IN_USE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static const struct file_operations iop_wdt_fops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) .llseek = no_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) .write = iop_wdt_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) .unlocked_ioctl = iop_wdt_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) .compat_ioctl = compat_ptr_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .open = iop_wdt_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .release = iop_wdt_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static struct miscdevice iop_wdt_miscdev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) .minor = WATCHDOG_MINOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .name = "watchdog",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) .fops = &iop_wdt_fops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static int __init iop_wdt_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) /* check if the reset was caused by the watchdog timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /* Configure Watchdog Timeout to cause an Internal Bus (IB) Reset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * NOTE: An IB Reset will Reset both cores in the IOP342
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) write_wdtsr(IOP13XX_WDTCR_IB_RESET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* Register after we have the device set up so we cannot race
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) with an open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) ret = misc_register(&iop_wdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) pr_info("timeout %lu sec\n", iop_watchdog_timeout());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static void __exit iop_wdt_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) misc_deregister(&iop_wdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) module_init(iop_wdt_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) module_exit(iop_wdt_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) module_param(nowayout, bool, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MODULE_AUTHOR("Curt E Bruns <curt.e.bruns@intel.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_DESCRIPTION("iop watchdog timer driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) MODULE_LICENSE("GPL");