static void imx2_wdt_shutdown(struct platform_device *pdev) { if (test_bit(IMX2_WDT_STATUS_STARTED, &imx2_wdt.status)) { /* we are running, we need to delete the timer but will give * max timeout before reboot will take place */ del_timer_sync(&imx2_wdt.timer); imx2_wdt_set_timeout(IMX2_WDT_MAX_TIME); imx2_wdt_ping(); dev_crit(imx2_wdt_miscdev.parent, "Device shutdown: Expect reboot!\n"); } }
static long imx2_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; int __user *p = argp; int new_value; switch (cmd) { case WDIOC_GETSUPPORT: return copy_to_user(argp, &imx2_wdt_info, sizeof(struct watchdog_info)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: return put_user(0, p); case WDIOC_KEEPALIVE: imx2_wdt_ping(); return 0; case WDIOC_SETTIMEOUT: if (get_user(new_value, p)) return -EFAULT; if ((new_value < 1) || (new_value > IMX2_WDT_MAX_TIME)) return -EINVAL; imx2_wdt_set_timeout(new_value); imx2_wdt.timeout = new_value; imx2_wdt_ping(); /* Fallthrough to return current value */ case WDIOC_GETTIMEOUT: return put_user(imx2_wdt.timeout, p); case WDIOC_SETPRETIMEOUT: if (get_user(new_value, p)) return -EFAULT; if ((new_value < 0) || (new_value >= imx2_wdt.timeout)) return -EINVAL; imx2_wdt_set_pretimeout(new_value); imx2_wdt.pretimeout = new_value; case WDIOC_GETPRETIMEOUT: return put_user(imx2_wdt.pretimeout, p); default: return -ENOTTY; } }
static void imx2_wdt_shutdown(struct platform_device *pdev) { // -> [Walker Chen] extern int phy_wol_enable( void ); phy_wol_enable(); // added WOL function // <- End. if (test_bit(IMX2_WDT_STATUS_STARTED, &imx2_wdt.status)) { /* we are running, we need to delete the timer but will give * max timeout before reboot will take place */ del_timer_sync(&imx2_wdt.timer); imx2_wdt_set_timeout(IMX2_WDT_MAX_TIME); imx2_wdt_ping(); dev_crit(imx2_wdt_miscdev.parent, "Device shutdown: Expect reboot!\n"); } }