static DEFINE_SPINLOCK(kapmd_queue_lock);
static struct apm_queue kapmd_queue;
-static DECLARE_MUTEX(state_lock);
+static DEFINE_MUTEX(state_lock);
static const char driver_version[] = "1.13"; /* no spaces */
struct apm_user *as;
int ret = 1;
- down(&state_lock);
+ mutex_lock(&state_lock);
down_read(&user_list_lock);
/*
}
out:
up_read(&user_list_lock);
- up(&state_lock);
+ mutex_unlock(&state_lock);
wake_up_interruptible(&apm_waitqueue);
return ret;
}
/*
* Finally, wake up anyone who is sleeping on the suspend.
*/
- down(&state_lock);
+ mutex_lock(&state_lock);
down_read(&user_list_lock);
list_for_each_entry(as, &apm_user_list, list) {
if (as->suspend_state == SUSPEND_WAIT ||
}
}
up_read(&user_list_lock);
- up(&state_lock);
+ mutex_unlock(&state_lock);
wake_up(&apm_suspend_waitqueue);
}
if (copy_to_user(buf, &event, sizeof(event)))
break;
- down(&state_lock);
+ mutex_lock(&state_lock);
if (as->suspend_state == SUSPEND_PENDING &&
(event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND))
as->suspend_state = SUSPEND_READ;
- up(&state_lock);
+ mutex_unlock(&state_lock);
buf += sizeof(event);
i -= sizeof(event);
switch (cmd) {
case APM_IOC_SUSPEND:
- down(&state_lock);
+ mutex_lock(&state_lock);
as->suspend_result = -EINTR;
as->suspend_state = SUSPEND_ACKED;
suspends_pending--;
pending = suspends_pending == 0;
- up(&state_lock);
+ mutex_unlock(&state_lock);
/*
* If there are no further acknowledges required,
as->suspend_state == SUSPEND_DONE);
} else {
as->suspend_state = SUSPEND_WAIT;
- up(&state_lock);
+ mutex_unlock(&state_lock);
/*
* Otherwise it is a request to suspend the system.
current->flags = flags;
- down(&state_lock);
+ mutex_lock(&state_lock);
err = as->suspend_result;
as->suspend_state = SUSPEND_NONE;
- up(&state_lock);
+ mutex_unlock(&state_lock);
break;
}
* need to balance suspends_pending, which means the
* possibility of sleeping.
*/
- down(&state_lock);
+ mutex_lock(&state_lock);
if (as->suspend_state != SUSPEND_NONE) {
suspends_pending -= 1;
pending = suspends_pending == 0;
}
- up(&state_lock);
+ mutex_unlock(&state_lock);
if (pending)
apm_suspend();