aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <ddrake@brontes3d.com>2006-10-20 09:56:01 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2006-12-07 15:31:25 -0500
commit75dcf5dc5a0dc4e895944368780cc2fc40008a55 (patch)
treee4fdb1e7515107bbff0543a7edbbdcfff7d87dbc
parent3c21cfc4babaf4d20384f6f70def308e9b945159 (diff)
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: Daniel Drake <ddrake@brontes3d.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/ieee1394/video1394.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index 776b6618e80e..77f58bc83135 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -714,8 +714,8 @@ static inline unsigned video1394_buffer_state(struct dma_iso_ctx *d,
714 return ret; 714 return ret;
715} 715}
716 716
717static int __video1394_ioctl(struct file *file, 717static long video1394_ioctl(struct file *file,
718 unsigned int cmd, unsigned long arg) 718 unsigned int cmd, unsigned long arg)
719{ 719{
720 struct file_ctx *ctx = (struct file_ctx *)file->private_data; 720 struct file_ctx *ctx = (struct file_ctx *)file->private_data;
721 struct ti_ohci *ohci = ctx->ohci; 721 struct ti_ohci *ohci = ctx->ohci;
@@ -1158,15 +1158,6 @@ static int __video1394_ioctl(struct file *file,
1158 } 1158 }
1159} 1159}
1160 1160
1161static long video1394_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1162{
1163 int err;
1164 lock_kernel();
1165 err = __video1394_ioctl(file, cmd, arg);
1166 unlock_kernel();
1167 return err;
1168}
1169
1170/* 1161/*
1171 * This maps the vmalloced and reserved buffer to user space. 1162 * This maps the vmalloced and reserved buffer to user space.
1172 * 1163 *
@@ -1179,17 +1170,14 @@ static long video1394_ioctl(struct file *file, unsigned int cmd, unsigned long a
1179static int video1394_mmap(struct file *file, struct vm_area_struct *vma) 1170static int video1394_mmap(struct file *file, struct vm_area_struct *vma)
1180{ 1171{
1181 struct file_ctx *ctx = (struct file_ctx *)file->private_data; 1172 struct file_ctx *ctx = (struct file_ctx *)file->private_data;
1182 int res = -EINVAL;
1183 1173
1184 lock_kernel();
1185 if (ctx->current_ctx == NULL) { 1174 if (ctx->current_ctx == NULL) {
1186 PRINT(KERN_ERR, ctx->ohci->host->id, 1175 PRINT(KERN_ERR, ctx->ohci->host->id,
1187 "Current iso context not set"); 1176 "Current iso context not set");
1188 } else 1177 return -EINVAL;
1189 res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); 1178 }
1190 unlock_kernel();
1191 1179
1192 return res; 1180 return dma_region_mmap(&ctx->current_ctx->dma, file, vma);
1193} 1181}
1194 1182
1195static unsigned int video1394_poll(struct file *file, poll_table *pt) 1183static 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 struct dma_iso_ctx *d; 1188 struct dma_iso_ctx *d;
1201 int i; 1189 int i;
1202 1190
1203 lock_kernel();
1204 ctx = file->private_data; 1191 ctx = file->private_data;
1205 d = ctx->current_ctx; 1192 d = ctx->current_ctx;
1206 if (d == NULL) { 1193 if (d == NULL) {
1207 PRINT(KERN_ERR, ctx->ohci->host->id, 1194 PRINT(KERN_ERR, ctx->ohci->host->id,
1208 "Current iso context not set"); 1195 "Current iso context not set");
1209 mask = POLLERR; 1196 return POLLERR;
1210 goto done;
1211 } 1197 }
1212 1198
1213 poll_wait(file, &d->waitq, pt); 1199 poll_wait(file, &d->waitq, pt);
@@ -1220,8 +1206,6 @@ static unsigned int video1394_poll(struct file *file, poll_table *pt)
1220 } 1206 }
1221 } 1207 }
1222 spin_unlock_irqrestore(&d->lock, flags); 1208 spin_unlock_irqrestore(&d->lock, flags);
1223done:
1224 unlock_kernel();
1225 1209
1226 return mask; 1210 return mask;
1227} 1211}
@@ -1257,7 +1241,6 @@ static int video1394_release(struct inode *inode, struct file *file)
1257 struct list_head *lh, *next; 1241 struct list_head *lh, *next;
1258 u64 mask; 1242 u64 mask;
1259 1243
1260 lock_kernel();
1261 list_for_each_safe(lh, next, &ctx->context_list) { 1244 list_for_each_safe(lh, next, &ctx->context_list) {
1262 struct dma_iso_ctx *d; 1245 struct dma_iso_ctx *d;
1263 d = list_entry(lh, struct dma_iso_ctx, link); 1246 d = list_entry(lh, struct dma_iso_ctx, link);
@@ -1278,7 +1261,6 @@ static int video1394_release(struct inode *inode, struct file *file)
1278 kfree(ctx); 1261 kfree(ctx);
1279 file->private_data = NULL; 1262 file->private_data = NULL;
1280 1263
1281 unlock_kernel();
1282 return 0; 1264 return 0;
1283} 1265}
1284 1266