Commit 75dcf5dc authored by Daniel Drake's avatar Daniel Drake Committed by Stefan Richter

video1394: remove BKL contention

video1394 does not need to take the BKL. The data structures shared between
file_operations and interrupts are already protected through context-specific
spinlocks.

The only other danger is video1394_release() being called during another
operation, however this cannot happen because release is only ever invoked
when the last thread has closed the fd.
Signed-off-by: default avatarDaniel Drake <ddrake@brontes3d.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 3c21cfc4
...@@ -714,7 +714,7 @@ static inline unsigned video1394_buffer_state(struct dma_iso_ctx *d, ...@@ -714,7 +714,7 @@ static inline unsigned video1394_buffer_state(struct dma_iso_ctx *d,
return ret; return ret;
} }
static int __video1394_ioctl(struct file *file, static long video1394_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct file_ctx *ctx = (struct file_ctx *)file->private_data; struct file_ctx *ctx = (struct file_ctx *)file->private_data;
...@@ -1158,15 +1158,6 @@ static int __video1394_ioctl(struct file *file, ...@@ -1158,15 +1158,6 @@ static int __video1394_ioctl(struct file *file,
} }
} }
static long video1394_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int err;
lock_kernel();
err = __video1394_ioctl(file, cmd, arg);
unlock_kernel();
return err;
}
/* /*
* This maps the vmalloced and reserved buffer to user space. * This maps the vmalloced and reserved buffer to user space.
* *
...@@ -1179,17 +1170,14 @@ static long video1394_ioctl(struct file *file, unsigned int cmd, unsigned long a ...@@ -1179,17 +1170,14 @@ static long video1394_ioctl(struct file *file, unsigned int cmd, unsigned long a
static int video1394_mmap(struct file *file, struct vm_area_struct *vma) static int video1394_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct file_ctx *ctx = (struct file_ctx *)file->private_data; struct file_ctx *ctx = (struct file_ctx *)file->private_data;
int res = -EINVAL;
lock_kernel();
if (ctx->current_ctx == NULL) { if (ctx->current_ctx == NULL) {
PRINT(KERN_ERR, ctx->ohci->host->id, PRINT(KERN_ERR, ctx->ohci->host->id,
"Current iso context not set"); "Current iso context not set");
} else return -EINVAL;
res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); }
unlock_kernel();
return res; return dma_region_mmap(&ctx->current_ctx->dma, file, vma);
} }
static unsigned int video1394_poll(struct file *file, poll_table *pt) static unsigned int video1394_poll(struct file *file, poll_table *pt)
...@@ -1200,14 +1188,12 @@ static unsigned int video1394_poll(struct file *file, poll_table *pt) ...@@ -1200,14 +1188,12 @@ static unsigned int video1394_poll(struct file *file, poll_table *pt)
struct dma_iso_ctx *d; struct dma_iso_ctx *d;
int i; int i;
lock_kernel();
ctx = file->private_data; ctx = file->private_data;
d = ctx->current_ctx; d = ctx->current_ctx;
if (d == NULL) { if (d == NULL) {
PRINT(KERN_ERR, ctx->ohci->host->id, PRINT(KERN_ERR, ctx->ohci->host->id,
"Current iso context not set"); "Current iso context not set");
mask = POLLERR; return POLLERR;
goto done;
} }
poll_wait(file, &d->waitq, pt); poll_wait(file, &d->waitq, pt);
...@@ -1220,8 +1206,6 @@ static unsigned int video1394_poll(struct file *file, poll_table *pt) ...@@ -1220,8 +1206,6 @@ static unsigned int video1394_poll(struct file *file, poll_table *pt)
} }
} }
spin_unlock_irqrestore(&d->lock, flags); spin_unlock_irqrestore(&d->lock, flags);
done:
unlock_kernel();
return mask; return mask;
} }
...@@ -1257,7 +1241,6 @@ static int video1394_release(struct inode *inode, struct file *file) ...@@ -1257,7 +1241,6 @@ static int video1394_release(struct inode *inode, struct file *file)
struct list_head *lh, *next; struct list_head *lh, *next;
u64 mask; u64 mask;
lock_kernel();
list_for_each_safe(lh, next, &ctx->context_list) { list_for_each_safe(lh, next, &ctx->context_list) {
struct dma_iso_ctx *d; struct dma_iso_ctx *d;
d = list_entry(lh, struct dma_iso_ctx, link); d = list_entry(lh, struct dma_iso_ctx, link);
...@@ -1278,7 +1261,6 @@ static int video1394_release(struct inode *inode, struct file *file) ...@@ -1278,7 +1261,6 @@ static int video1394_release(struct inode *inode, struct file *file)
kfree(ctx); kfree(ctx);
file->private_data = NULL; file->private_data = NULL;
unlock_kernel();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment