aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-07-25 04:48:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:43 -0400
commit236b8756a2b6f90498d45b2c36d43e5372f2d4b8 (patch)
treebdca24e185d88914b1f2074166f9aa4be353b40f
parentb8e35919653d76e7dceb8d3b8569c4ec1004d546 (diff)
dsp56k: BKL pushdown
Push the BKL down into the driver ioctl methods Signed-off-by: Alan Cox <alan@redhat.com> Cc: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/dsp56k.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 33c466a4888f..19b88504e960 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -36,10 +36,10 @@
36#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
37#include <linux/firmware.h> 37#include <linux/firmware.h>
38#include <linux/platform_device.h> 38#include <linux/platform_device.h>
39#include <linux/uaccess.h> /* For put_user and get_user */
39 40
40#include <asm/atarihw.h> 41#include <asm/atarihw.h>
41#include <asm/traps.h> 42#include <asm/traps.h>
42#include <asm/uaccess.h> /* For put_user and get_user */
43 43
44#include <asm/dsp56k.h> 44#include <asm/dsp56k.h>
45 45
@@ -303,8 +303,8 @@ static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t co
303 } 303 }
304} 304}
305 305
306static int dsp56k_ioctl(struct inode *inode, struct file *file, 306static long dsp56k_ioctl(struct file *file, unsigned int cmd,
307 unsigned int cmd, unsigned long arg) 307 unsigned long arg)
308{ 308{
309 int dev = iminor(inode) & 0x0f; 309 int dev = iminor(inode) & 0x0f;
310 void __user *argp = (void __user *)arg; 310 void __user *argp = (void __user *)arg;
@@ -331,8 +331,9 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
331 if (len > DSP56K_MAX_BINARY_LENGTH) { 331 if (len > DSP56K_MAX_BINARY_LENGTH) {
332 return -EINVAL; 332 return -EINVAL;
333 } 333 }
334 334 lock_kernel();
335 r = dsp56k_upload(bin, len); 335 r = dsp56k_upload(bin, len);
336 unlock_kernel();
336 if (r < 0) { 337 if (r < 0) {
337 return r; 338 return r;
338 } 339 }
@@ -342,12 +343,16 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
342 case DSP56K_SET_TX_WSIZE: 343 case DSP56K_SET_TX_WSIZE:
343 if (arg > 4 || arg < 1) 344 if (arg > 4 || arg < 1)
344 return -EINVAL; 345 return -EINVAL;
346 lock_kernel();
345 dsp56k.tx_wsize = (int) arg; 347 dsp56k.tx_wsize = (int) arg;
348 unlock_kernel();
346 break; 349 break;
347 case DSP56K_SET_RX_WSIZE: 350 case DSP56K_SET_RX_WSIZE:
348 if (arg > 4 || arg < 1) 351 if (arg > 4 || arg < 1)
349 return -EINVAL; 352 return -EINVAL;
353 lock_kernel();
350 dsp56k.rx_wsize = (int) arg; 354 dsp56k.rx_wsize = (int) arg;
355 unlock_kernel();
351 break; 356 break;
352 case DSP56K_HOST_FLAGS: 357 case DSP56K_HOST_FLAGS:
353 { 358 {
@@ -359,6 +364,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
359 if(get_user(out, &hf->out) < 0) 364 if(get_user(out, &hf->out) < 0)
360 return -EFAULT; 365 return -EFAULT;
361 366
367 lock_kernel();
362 if ((dir & 0x1) && (out & 0x1)) 368 if ((dir & 0x1) && (out & 0x1))
363 dsp56k_host_interface.icr |= DSP56K_ICR_HF0; 369 dsp56k_host_interface.icr |= DSP56K_ICR_HF0;
364 else if (dir & 0x1) 370 else if (dir & 0x1)
@@ -373,14 +379,16 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
373 if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2; 379 if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2;
374 if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4; 380 if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4;
375 if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8; 381 if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8;
376 382 unlock_kernel();
377 return put_user(status, &hf->status); 383 return put_user(status, &hf->status);
378 } 384 }
379 case DSP56K_HOST_CMD: 385 case DSP56K_HOST_CMD:
380 if (arg > 31 || arg < 0) 386 if (arg > 31 || arg < 0)
381 return -EINVAL; 387 return -EINVAL;
388 lock_kernel();
382 dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | 389 dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) |
383 DSP56K_CVR_HC); 390 DSP56K_CVR_HC);
391 unlock_kernel();
384 break; 392 break;
385 default: 393 default:
386 return -EINVAL; 394 return -EINVAL;
@@ -472,7 +480,7 @@ static const struct file_operations dsp56k_fops = {
472 .owner = THIS_MODULE, 480 .owner = THIS_MODULE,
473 .read = dsp56k_read, 481 .read = dsp56k_read,
474 .write = dsp56k_write, 482 .write = dsp56k_write,
475 .ioctl = dsp56k_ioctl, 483 .unlocked_ioctl = dsp56k_ioctl,
476 .open = dsp56k_open, 484 .open = dsp56k_open,
477 .release = dsp56k_release, 485 .release = dsp56k_release,
478}; 486};