* [PATCH] hpet: Remove BKL from hpet_open @ 2009-10-18 20:11 John Kacur 2009-10-21 11:43 ` hpet: Convert to unlocked_ioctl John Kacur 0 siblings, 1 reply; 3+ messages in thread From: John Kacur @ 2009-10-18 20:11 UTC (permalink / raw) To: linux-kernel, Thomas Gleixner Cc: Alan Cox, Arnd Bergmann, Ingo Molnar, Frederic Weisbecker >From 8dea55a14071c1b3445fc8a934f96c47dd35a1e1 Mon Sep 17 00:00:00 2001 From: John Kacur <jkacur@redhat.com> Date: Sun, 18 Oct 2009 22:07:01 +0200 Subject: [PATCH] hpet: Remove BKL from hpet_open hpet_open received the BKL from commit 48b81880519274d2a8b3e9919a47d91d05a1c964 during the BKL pushdown. It is not needed here because everything is serialized via the hpet_lock Signed-off-by: John Kacur <jkacur@redhat.com> --- drivers/char/hpet.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 70a770a..5e83828 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -14,7 +14,6 @@ #include <linux/interrupt.h> #include <linux/module.h> #include <linux/kernel.h> -#include <linux/smp_lock.h> #include <linux/types.h> #include <linux/miscdevice.h> #include <linux/major.h> @@ -251,7 +250,6 @@ static int hpet_open(struct inode *inode, struct file *file) if (file->f_mode & FMODE_WRITE) return -EINVAL; - lock_kernel(); spin_lock_irq(&hpet_lock); for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next) @@ -265,7 +263,6 @@ static int hpet_open(struct inode *inode, struct file *file) if (!devp) { spin_unlock_irq(&hpet_lock); - unlock_kernel(); return -EBUSY; } @@ -273,7 +270,6 @@ static int hpet_open(struct inode *inode, struct file *file) devp->hd_irqdata = 0; devp->hd_flags |= HPET_OPEN; spin_unlock_irq(&hpet_lock); - unlock_kernel(); hpet_timer_set_irq(devp); -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* hpet: Convert to unlocked_ioctl 2009-10-18 20:11 [PATCH] hpet: Remove BKL from hpet_open John Kacur @ 2009-10-21 11:43 ` John Kacur 2009-10-21 11:50 ` Clemens Ladisch 0 siblings, 1 reply; 3+ messages in thread From: John Kacur @ 2009-10-21 11:43 UTC (permalink / raw) To: linux-kernel, Thomas Gleixner Cc: Alan Cox, Arnd Bergmann, Ingo Molnar, Frederic Weisbecker, Clemens Ladisch This patch converts the hpet_ioctl to the unlocked version. It is meant to be applied after the patch that removed the BKL from the hpet_open function. Note that .llseek is already explicitly set to no_llseek. >From 84e9964c4c7eeb4e99bb51e3a10768c1f869f259 Mon Sep 17 00:00:00 2001 From: John Kacur <jkacur@redhat.com> Date: Wed, 21 Oct 2009 13:34:42 +0200 Subject: [PATCH] hpet: Convert to unlocked_ioctl The ioctl functions here rely on their own locking using the hpet_lock spinlock. Signed-off-by: John Kacur <jkacur@redhat.com> --- drivers/char/hpet.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 5e83828..e7754cd 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -426,11 +426,9 @@ static int hpet_release(struct inode *inode, struct file *file) return 0; } -static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); +static long hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); -static int -hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) +static long hpet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct hpet_dev *devp; @@ -438,7 +436,7 @@ hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return hpet_ioctl_common(devp, cmd, arg, 0); } -static int hpet_ioctl_ieon(struct hpet_dev *devp) +static long hpet_ioctl_ieon(struct hpet_dev *devp) { struct hpet_timer __iomem *timer; struct hpet __iomem *hpet; @@ -545,13 +543,13 @@ static inline unsigned long hpet_time_div(struct hpets *hpets, return (unsigned long)m; } -static int +static long hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) { struct hpet_timer __iomem *timer; struct hpet __iomem *hpet; struct hpets *hpetp; - int err; + long err = 0; unsigned long v; switch (cmd) { @@ -570,8 +568,6 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) return -EINVAL; } - err = 0; - switch (cmd) { case HPET_IE_OFF: if ((devp->hd_flags & HPET_IE) == 0) @@ -651,7 +647,7 @@ static const struct file_operations hpet_fops = { .llseek = no_llseek, .read = hpet_read, .poll = hpet_poll, - .ioctl = hpet_ioctl, + .unlocked_ioctl = hpet_ioctl, .open = hpet_open, .release = hpet_release, .fasync = hpet_fasync, -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: hpet: Convert to unlocked_ioctl 2009-10-21 11:43 ` hpet: Convert to unlocked_ioctl John Kacur @ 2009-10-21 11:50 ` Clemens Ladisch 0 siblings, 0 replies; 3+ messages in thread From: Clemens Ladisch @ 2009-10-21 11:50 UTC (permalink / raw) To: John Kacur Cc: linux-kernel, Thomas Gleixner, Alan Cox, Arnd Bergmann, Ingo Molnar, Frederic Weisbecker John Kacur wrote: > This patch converts the hpet_ioctl to the unlocked version. It is meant to > be applied after the patch that removed the BKL from the hpet_open > function. > > From: John Kacur <jkacur@redhat.com> > Date: Wed, 21 Oct 2009 13:34:42 +0200 > Subject: [PATCH] hpet: Convert to unlocked_ioctl > > The ioctl functions here rely on their own locking using the hpet_lock spinlock. > > Signed-off-by: John Kacur <jkacur@redhat.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> (for both patches) ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-21 11:52 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-10-18 20:11 [PATCH] hpet: Remove BKL from hpet_open John Kacur 2009-10-21 11:43 ` hpet: Convert to unlocked_ioctl John Kacur 2009-10-21 11:50 ` Clemens Ladisch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox