This pushes the lock a fair way down and the final kill looks like it
should be an easy project for someone who wants to have a shot at it.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: mingo@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
#include <linux/suspend.h>
#include <linux/kthread.h>
#include <linux/jiffies.h>
#include <linux/suspend.h>
#include <linux/kthread.h>
#include <linux/jiffies.h>
+#include <linux/smp_lock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/uaccess.h>
as->event_tail = 0;
}
as->events[as->event_head] = event;
as->event_tail = 0;
}
as->events[as->event_head] = event;
- if ((!as->suser) || (!as->writer))
+ if (!as->suser || !as->writer)
continue;
switch (event) {
case APM_SYS_SUSPEND:
continue;
switch (event) {
case APM_SYS_SUSPEND:
static int check_apm_user(struct apm_user *as, const char *func)
{
static int check_apm_user(struct apm_user *as, const char *func)
{
- if ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) {
+ if (as == NULL || as->magic != APM_BIOS_MAGIC) {
printk(KERN_ERR "apm: %s passed bad filp\n", func);
return 1;
}
printk(KERN_ERR "apm: %s passed bad filp\n", func);
return 1;
}
-static int do_ioctl(struct inode *inode, struct file *filp,
- u_int cmd, u_long arg)
+static long do_ioctl(struct file *filp, u_int cmd, u_long arg)
as = filp->private_data;
if (check_apm_user(as, "ioctl"))
return -EIO;
as = filp->private_data;
if (check_apm_user(as, "ioctl"))
return -EIO;
- if ((!as->suser) || (!as->writer))
+ if (!as->suser || !as->writer)
return -EPERM;
switch (cmd) {
case APM_IOC_STANDBY:
return -EPERM;
switch (cmd) {
case APM_IOC_STANDBY:
if (as->standbys_read > 0) {
as->standbys_read--;
as->standbys_pending--;
if (as->standbys_read > 0) {
as->standbys_read--;
as->standbys_pending--;
queue_event(APM_USER_STANDBY, as);
if (standbys_pending <= 0)
standby();
queue_event(APM_USER_STANDBY, as);
if (standbys_pending <= 0)
standby();
break;
case APM_IOC_SUSPEND:
break;
case APM_IOC_SUSPEND:
if (as->suspends_read > 0) {
as->suspends_read--;
as->suspends_pending--;
if (as->suspends_read > 0) {
as->suspends_read--;
as->suspends_pending--;
} else
queue_event(APM_USER_SUSPEND, as);
if (suspends_pending <= 0) {
} else
queue_event(APM_USER_SUSPEND, as);
if (suspends_pending <= 0) {
} else {
as->suspend_wait = 1;
wait_event_interruptible(apm_suspend_waitqueue,
as->suspend_wait == 0);
} else {
as->suspend_wait = 1;
wait_event_interruptible(apm_suspend_waitqueue,
as->suspend_wait == 0);
- return as->suspend_result;
+ ret = as->suspend_result;
+ unlock_kernel();
+ return ret;
.owner = THIS_MODULE,
.read = do_read,
.poll = do_poll,
.owner = THIS_MODULE,
.read = do_read,
.poll = do_poll,
+ .unlocked_ioctl = do_ioctl,
.open = do_open,
.release = do_release,
};
.open = do_open,
.release = do_release,
};