* [PATCH] HPET: Remove the BKL.
@ 2008-10-09 11:22 David John
2008-10-09 12:59 ` Andi Kleen
0 siblings, 1 reply; 7+ messages in thread
From: David John @ 2008-10-09 11:22 UTC (permalink / raw)
To: mingo; +Cc: linux-kernel, clemens, venkatesh.pallipadi, vojtech, bob.picco
Concurrent access is protected by the spin lock hpet_lock. The
BKL is not required.
Signed-off-by: David John <davidjon@xenontk.org>
---
drivers/char/hpet.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index b3f5dbc..0237eeb 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -194,7 +194,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)
@@ -209,7 +208,6 @@ static int hpet_open(struct inode *inode, struct file *file)
if (!devp) {
spin_unlock_irq(&hpet_lock);
- unlock_kernel();
return -EBUSY;
}
@@ -217,7 +215,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();
return 0;
}
@@ -586,7 +583,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,
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] HPET: Remove the BKL.
2008-10-09 11:22 [PATCH] HPET: Remove the BKL David John
@ 2008-10-09 12:59 ` Andi Kleen
2008-10-09 14:30 ` David John
0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2008-10-09 12:59 UTC (permalink / raw)
To: David John
Cc: mingo, linux-kernel, clemens, venkatesh.pallipadi, vojtech,
bob.picco
David John <davidjon@xenontk.org> writes:
> @@ -586,7 +583,7 @@ static const struct file_operations hpet_fops = {
> .llseek = no_llseek,
> .read = hpet_read,
> .poll = hpet_poll,
> - .ioctl = hpet_ioctl,
> + .unlocked_ioctl = hpet_ioctl,
Did this actually compile without warning? unlocked_ioctl
has a different prototype than ioctl
-Andi
--
ak@linux.intel.com
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] HPET: Remove the BKL.
2008-10-09 12:59 ` Andi Kleen
@ 2008-10-09 14:30 ` David John
0 siblings, 0 replies; 7+ messages in thread
From: David John @ 2008-10-09 14:30 UTC (permalink / raw)
To: Andi Kleen
Cc: mingo, linux-kernel, clemens, venkatesh.pallipadi, vojtech,
bob.picco, alan
Andi Kleen wrote:
> David John <davidjon@xenontk.org> writes:
>> @@ -586,7 +583,7 @@ static const struct file_operations hpet_fops = {
>> .llseek = no_llseek,
>> .read = hpet_read,
>> .poll = hpet_poll,
>> - .ioctl = hpet_ioctl,
>> + .unlocked_ioctl = hpet_ioctl,
>
> Did this actually compile without warning? unlocked_ioctl
> has a different prototype than ioctl
>
> -Andi
>
Argg. I didn't check. :-[. Incidentally, this seems to have been done by
Alan here: http://lkml.org/lkml/2008/5/22/350. Was the patch dropped later?
CC'd: Alan Cox
David.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] HPET: Remove the BKL.
@ 2008-10-10 8:00 David John
0 siblings, 0 replies; 7+ messages in thread
From: David John @ 2008-10-10 8:00 UTC (permalink / raw)
To: venkatesh.pallipadi; +Cc: clemens, vojtech, bob.picco, linux-kernel, andi
Can you review/check this patch? Compile tested only as I
don't have a machine with HPET.
CC'd: LKML.
---
From: David John <davidjon@xenontk.org>
Concurrent access is protected by the spin lock hpet_lock. The BKL
is not required.
Signed-off-by: David John <davidjon@xenontk.org>
---
drivers/char/hpet.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index b3f5dbc..3393566 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -194,7 +194,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)
@@ -209,7 +208,6 @@ static int hpet_open(struct inode *inode, struct file *file)
if (!devp) {
spin_unlock_irq(&hpet_lock);
- unlock_kernel();
return -EBUSY;
}
@@ -217,7 +215,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();
return 0;
}
@@ -375,15 +372,12 @@ 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;
-
- devp = file->private_data;
+ struct hpet_dev *devp = file->private_data;
return hpet_ioctl_common(devp, cmd, arg, 0);
}
@@ -480,13 +474,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;
unsigned long v;
switch (cmd) {
@@ -518,7 +512,9 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
free_irq(devp->hd_irq, devp);
devp->hd_irq = 0;
}
+ spin_lock_irq(&hpet_lock);
devp->hd_flags ^= HPET_IE;
+ spin_unlock_irq(&hpet_lock);
break;
case HPET_INFO:
{
@@ -547,7 +543,9 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
err = -ENXIO;
break;
}
+ spin_lock_irq(&hpet_lock);
devp->hd_flags |= HPET_PERIODIC;
+ spin_unlock_irq(&hpet_lock);
break;
case HPET_DPI:
v = readq(&timer->hpet_config);
@@ -561,7 +559,9 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
v ^= Tn_TYPE_CNF_MASK;
writeq(v, &timer->hpet_config);
}
+ spin_lock_irq(&hpet_lock);
devp->hd_flags &= ~HPET_PERIODIC;
+ spin_unlock_irq(&hpet_lock);
break;
case HPET_IRQFREQ:
if (!kernel && (arg > hpet_max_freq) &&
@@ -586,7 +586,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,
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH] HPET: Remove the BKL.
@ 2008-10-09 8:55 David John
2008-10-09 10:31 ` Andi Kleen
0 siblings, 1 reply; 7+ messages in thread
From: David John @ 2008-10-09 8:55 UTC (permalink / raw)
To: mingo; +Cc: linux-kernel, clemens, venkatesh.pallipadi, vojtech, bob.picco
Concurrent access is protected by the spin lock hpet_lock. The
BKL is not required.
Signed-off-by: David John <davidjon@xenontk.org>
---
drivers/char/hpet.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index b3f5dbc..00765f9 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -194,7 +194,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)
@@ -209,7 +208,6 @@ static int hpet_open(struct inode *inode, struct file *file)
if (!devp) {
spin_unlock_irq(&hpet_lock);
- unlock_kernel();
return -EBUSY;
}
@@ -217,7 +215,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();
return 0;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] HPET: Remove the BKL.
2008-10-09 8:55 David John
@ 2008-10-09 10:31 ` Andi Kleen
2008-10-09 11:08 ` David John
0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2008-10-09 10:31 UTC (permalink / raw)
To: David John
Cc: mingo, linux-kernel, clemens, venkatesh.pallipadi, vojtech,
bob.picco
David John <davidjon@xenontk.org> writes:
> Concurrent access is protected by the spin lock hpet_lock. The
> BKL is not required.
You should probably also convert the .ioctl = ... to .unlocked_ioctl.
Otherwise you still got implicit BKL for the ioctls.
-Andi
--
ak@linux.intel.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] HPET: Remove the BKL.
2008-10-09 10:31 ` Andi Kleen
@ 2008-10-09 11:08 ` David John
0 siblings, 0 replies; 7+ messages in thread
From: David John @ 2008-10-09 11:08 UTC (permalink / raw)
To: Andi Kleen
Cc: mingo, linux-kernel, clemens, venkatesh.pallipadi, vojtech,
bob.picco
Andi Kleen wrote:
> David John <davidjon@xenontk.org> writes:
>
>> Concurrent access is protected by the spin lock hpet_lock. The
>> BKL is not required.
>
> You should probably also convert the .ioctl = ... to .unlocked_ioctl.
> Otherwise you still got implicit BKL for the ioctls.
>
> -Andi
>
Thanks. I'll fix it up.
David.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-10 8:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 11:22 [PATCH] HPET: Remove the BKL David John
2008-10-09 12:59 ` Andi Kleen
2008-10-09 14:30 ` David John
-- strict thread matches above, loose matches on Subject: below --
2008-10-10 8:00 David John
2008-10-09 8:55 David John
2008-10-09 10:31 ` Andi Kleen
2008-10-09 11:08 ` David John
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox