From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk
Subject: Re: [PATCH] apm_emu: push BKL down into ioctl handlers
Date: Thu, 22 May 2008 23:17:27 +0100 [thread overview]
Message-ID: <20080522231727.4b0c4da4@core> (raw)
In-Reply-To: <20080522204059.GB24212@uranus.ravnborg.org>
On Thu, 22 May 2008 22:40:59 +0200
Sam Ravnborg <sam@ravnborg.org> wrote:
> On Thu, May 22, 2008 at 09:23:41PM +0100, Alan Cox wrote:
> > Part of the elimination of the old lock based ioctl. This one can
> > probably lose the remaining BKL pretty trivially
> >
> > Signed-off-by: Alan Cox <alan@redhat.com>
> -ENOPATCH
Must be race between the sending gnomes and the pasting gnome ;)
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index cdd876d..4ea7188 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -29,6 +29,7 @@
#include <linux/completion.h>
#include <linux/kthread.h>
#include <linux/delay.h>
+#include <linux/smp_lock.h>
#include <asm/system.h>
@@ -292,8 +293,7 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)
* Only when everyone who has opened /dev/apm_bios with write permission
* has acknowledge does the actual suspend happen.
*/
-static int
-apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
+static long apm_ioctl(struct file *filp, u_int cmd, u_long arg)
{
struct apm_user *as = filp->private_data;
int err = -EINVAL;
@@ -301,6 +301,8 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
if (!as->suser || !as->writer)
return -EPERM;
+ lock_kernel();
+
switch (cmd) {
case APM_IOC_SUSPEND:
mutex_lock(&state_lock);
@@ -378,7 +380,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
mutex_unlock(&state_lock);
break;
}
-
+ unlock_kernel();
return err;
}
@@ -443,7 +445,7 @@ static struct file_operations apm_bios_fops = {
.owner = THIS_MODULE,
.read = apm_read,
.poll = apm_poll,
- .ioctl = apm_ioctl,
+ .unlocked_ioctl = apm_ioctl,
.open = apm_open,
.release = apm_release,
};
prev parent reply other threads:[~2008-05-22 22:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 20:23 [PATCH] apm_emu: push BKL down into ioctl handlers Alan Cox
2008-05-22 20:40 ` Sam Ravnborg
2008-05-22 22:17 ` Alan Cox [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080522231727.4b0c4da4@core \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox