kernels/linux-2.4.0/drivers/char/i810_rng.c
/*
 * rng_handle_sysctl_enable - handle a read or write of our enable/disable sysctl
 */
handle a read or write of our enable/disable sysctl
handle a read or write of our enable / disable sysctl
static int rng_handle_sysctl_enable (ctl_table * table, int write, struct file *filp,
				     void *buffer, size_t * lenp)
{
	int enabled_save, rc;
	DPRINTK ("ENTER\n");
	MOD_INC_USE_COUNT;
	spin_lock_bh (&rng_lock);
	rng_enabled_sysctl = enabled_save = rng_timer_enabled;
	spin_unlock_bh (&rng_lock);
	rc = proc_dointvec (table, write, filp, buffer, lenp);
	if (rc)
		return rc;
	spin_lock_bh (&rng_lock);
	if (enabled_save != rng_enabled_sysctl) {
		rng_timer_enabled = rng_enabled_sysctl;
		spin_unlock_bh (&rng_lock);
		rng_enable (rng_enabled_sysctl);
		if (rng_enabled_sysctl) {
			rng_timer.expires = jiffies + rng_timer_len;
			add_timer (&rng_timer);
		} else {
			del_timer_sync (&rng_timer);
		}
	} else {
		spin_unlock_bh (&rng_lock);
	}
	MOD_DEC_USE_COUNT;
	DPRINTK ("EXIT, returning 0\n");
	return 0;
}
static int rng_handle_sysctl_enable ( ctl_table * table , int write , struct file * filp , void * buffer , size_t * lenp ) { int enabled_save , rc ; DPRINTK ( " \n " ) ; MOD_INC_USE_COUNT ; spin_lock_bh ( & rng_lock ) ; rng_enabled_sysctl = enabled_save = rng_timer_enabled ; spin_unlock_bh ( & rng_lock ) ; rc = proc_dointvec ( table , write , filp , buffer , lenp ) ; if ( rc ) return rc ; spin_lock_bh ( & rng_lock ) ; if ( enabled_save != rng_enabled_sysctl ) { rng_timer_enabled = rng_enabled_sysctl ; spin_unlock_bh ( & rng_lock ) ; rng_enable ( rng_enabled_sysctl ) ; if ( rng_enabled_sysctl ) { rng_timer . expires = jiffies + rng_timer_len ; add_timer ( & rng_timer ) ; } else { del_timer_sync ( & rng_timer ) ; } } else { spin_unlock_bh ( & rng_lock ) ; } MOD_DEC_USE_COUNT ; DPRINTK ( " \n " ) ; return 0 ; }
rng_handle_sysctl_enable - handle a read or write of our enable/disable sysctl
rng_handle_sysctl_enable - handle a read or write of our enable / disable sysctl
/* enable/disable hardware */ /* enable/disable timer */ /* This needs to be in a higher layer */