Esempio n. 1
0
/*
 * The real-time timer, interrupting hz times per second.
 */
void
uinet_hardclock(void)
{

	atomic_add_int((volatile int *)&ticks, 1);

	/* hardclock_cpu(usermode);
	 *
	 * There is no need for the process accounting done in
	 * hardclock_cpu().  We only need the callout_tick() call, which is
	 * reproduced below.
	 */

	callout_tick();
	tc_ticktock(1);

	/* cpu_tick_calibration();
	 *
	 * There is no need for cpu_tick_calibration(), as we are operating
	 * as a fixed-rate ticker.
	 */

	/*
	 * If no separate statistics clock is available, run it from here.
	 *
	 * XXX: this only works for UP
	 */
	/* if (stathz == 0) {
	 *	profclock(usermode, pc);
	 *	statclock(usermode);
	 * }
	 *
	 * No need for profclock or statclock support.
	 */

#ifndef UINET  /* No DEVICE_POLLING or SW_WATCHDOG support under UINET */
#ifdef DEVICE_POLLING
	hardclock_device_poll();	/* this is very short and quick */
#endif /* DEVICE_POLLING */
#ifdef SW_WATCHDOG
	if (watchdog_enabled > 0 && --watchdog_ticks <= 0)
		watchdog_fire();
#endif /* SW_WATCHDOG */
#endif /* UINET */
}
static int intel_scu_release(struct inode *inode, struct file *file)
{
	/*
	 * This watchdog should not be closed, after the timer
	 * is started with the WDIPC_SETTIMEOUT ioctl
	 * If force_boot is set watchdog_fire() will cause an
	 * immediate reset. If force_boot is not set, the watchdog
	 * timer is refreshed for one more interval. At the end
	 * of that interval, the watchdog timer will reset the system.
	 */

	if (!test_and_clear_bit(0, &watchdog_device.driver_open)) {
		pr_debug("Watchdog timer: intel_scu_release, without open\n");
		return -ENOTTY;
	}

	if (!watchdog_device.timer_started) {
		/* Just close, since timer has not been started */
		pr_debug("Watchdog timer: closed, without starting timer\n");
		return 0;
	}

#ifdef CONFIG_DEBUG_PRINTK
	printk(KERN_CRIT PFX
	       "Unexpected close of /dev/watchdog!\n");
#else
	;
#endif

	/* Since the timer was started, prevent future reopens */
	watchdog_device.driver_closed = 1;

	/* Refresh the timer for one more interval */
	intel_scu_keepalive();

	/* Reboot system (if force_boot is set) */
	watchdog_fire();

	/* We should only reach this point if force_boot is not set */
	return 0;
}