static int cmode_procctl(ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *fpos) { int new_cmode; if (!write) return proc_dointvec(ctl, write, buffer, lenp, fpos); new_cmode = user_atoi(buffer, *lenp); return try_set_cmode(new_cmode)?:*lenp; }
static int p0_procctl(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *fpos) { int new_p0; if (!write) return proc_dointvec(ctl, write, buffer, lenp, fpos); new_p0 = user_atoi(buffer, *lenp); return try_set_p0(new_p0)?:*lenp; }
/* * Send us to sleep. */ static int sysctl_pm_do_suspend(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *fpos) { int mode; if (*lenp <= 0) return -EIO; mode = user_atoi(buffer, *lenp); switch (mode) { case 1: return pm_do_suspend(); case 5: return pm_do_bus_sleep(); default: return -EINVAL; } }
/* * Send us to sleep. */ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *fpos) { int retval, mode; if (*lenp <= 0) return -EIO; mode = user_atoi(buffer, *lenp); if ((mode != 1) && (mode != 5)) return -EINVAL; if (retval == 0) { if (mode == 5) retval = pm_do_bus_sleep(); else retval = pm_do_suspend(); } return retval; }
/* * Send us to sleep. */ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp, void __user *buffer, size_t *lenp, loff_t *fpos) { int retval, mode; if (*lenp <= 0) return -EIO; mode = user_atoi(buffer, *lenp); if ((mode != 1) && (mode != 5)) return -EINVAL; retval = pm_send_all(PM_SUSPEND, (void *)3); if (retval == 0) { if (mode == 5) retval = pm_do_bus_sleep(); else retval = pm_do_suspend(); pm_send_all(PM_RESUME, (void *)0); } return retval; }