|
@@ -153,23 +153,22 @@ static int user_atoi(char __user *ubuf, size_t len)
|
|
|
static int sysctl_pm_do_suspend(ctl_table *ctl, int write,
|
|
|
void __user *buffer, size_t *lenp, loff_t *fpos)
|
|
|
{
|
|
|
- int retval, mode;
|
|
|
+ int mode;
|
|
|
|
|
|
if (*lenp <= 0)
|
|
|
return -EIO;
|
|
|
|
|
|
mode = user_atoi(buffer, *lenp);
|
|
|
- if ((mode != 1) && (mode != 5))
|
|
|
- return -EINVAL;
|
|
|
+ switch (mode) {
|
|
|
+ case 1:
|
|
|
+ return pm_do_suspend();
|
|
|
|
|
|
- if (retval == 0) {
|
|
|
- if (mode == 5)
|
|
|
- retval = pm_do_bus_sleep();
|
|
|
- else
|
|
|
- retval = pm_do_suspend();
|
|
|
- }
|
|
|
+ case 5:
|
|
|
+ return pm_do_bus_sleep();
|
|
|
|
|
|
- return retval;
|
|
|
+ default:
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static int try_set_cmode(int new_cmode)
|