Commit 236b8756a2b6f90498d45b2c36d43e5372f2d4b8
Committed by
Linus Torvalds
1 parent
b8e3591965
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 14 additions and 6 deletions Side-by-side Diff
drivers/char/dsp56k.c
... | ... | @@ -36,10 +36,10 @@ |
36 | 36 | #include <linux/smp_lock.h> |
37 | 37 | #include <linux/firmware.h> |
38 | 38 | #include <linux/platform_device.h> |
39 | +#include <linux/uaccess.h> /* For put_user and get_user */ | |
39 | 40 | |
40 | 41 | #include <asm/atarihw.h> |
41 | 42 | #include <asm/traps.h> |
42 | -#include <asm/uaccess.h> /* For put_user and get_user */ | |
43 | 43 | |
44 | 44 | #include <asm/dsp56k.h> |
45 | 45 | |
... | ... | @@ -303,8 +303,8 @@ |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -static int dsp56k_ioctl(struct inode *inode, struct file *file, | |
307 | - unsigned int cmd, unsigned long arg) | |
306 | +static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |
307 | + unsigned long arg) | |
308 | 308 | { |
309 | 309 | int dev = iminor(inode) & 0x0f; |
310 | 310 | void __user *argp = (void __user *)arg; |
311 | 311 | |
... | ... | @@ -331,8 +331,9 @@ |
331 | 331 | if (len > DSP56K_MAX_BINARY_LENGTH) { |
332 | 332 | return -EINVAL; |
333 | 333 | } |
334 | - | |
334 | + lock_kernel(); | |
335 | 335 | r = dsp56k_upload(bin, len); |
336 | + unlock_kernel(); | |
336 | 337 | if (r < 0) { |
337 | 338 | return r; |
338 | 339 | } |
339 | 340 | |
340 | 341 | |
341 | 342 | |
... | ... | @@ -342,12 +343,16 @@ |
342 | 343 | case DSP56K_SET_TX_WSIZE: |
343 | 344 | if (arg > 4 || arg < 1) |
344 | 345 | return -EINVAL; |
346 | + lock_kernel(); | |
345 | 347 | dsp56k.tx_wsize = (int) arg; |
348 | + unlock_kernel(); | |
346 | 349 | break; |
347 | 350 | case DSP56K_SET_RX_WSIZE: |
348 | 351 | if (arg > 4 || arg < 1) |
349 | 352 | return -EINVAL; |
353 | + lock_kernel(); | |
350 | 354 | dsp56k.rx_wsize = (int) arg; |
355 | + unlock_kernel(); | |
351 | 356 | break; |
352 | 357 | case DSP56K_HOST_FLAGS: |
353 | 358 | { |
... | ... | @@ -359,6 +364,7 @@ |
359 | 364 | if(get_user(out, &hf->out) < 0) |
360 | 365 | return -EFAULT; |
361 | 366 | |
367 | + lock_kernel(); | |
362 | 368 | if ((dir & 0x1) && (out & 0x1)) |
363 | 369 | dsp56k_host_interface.icr |= DSP56K_ICR_HF0; |
364 | 370 | else if (dir & 0x1) |
365 | 371 | |
366 | 372 | |
... | ... | @@ -373,14 +379,16 @@ |
373 | 379 | if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2; |
374 | 380 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4; |
375 | 381 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8; |
376 | - | |
382 | + unlock_kernel(); | |
377 | 383 | return put_user(status, &hf->status); |
378 | 384 | } |
379 | 385 | case DSP56K_HOST_CMD: |
380 | 386 | if (arg > 31 || arg < 0) |
381 | 387 | return -EINVAL; |
388 | + lock_kernel(); | |
382 | 389 | dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | |
383 | 390 | DSP56K_CVR_HC); |
391 | + unlock_kernel(); | |
384 | 392 | break; |
385 | 393 | default: |
386 | 394 | return -EINVAL; |
... | ... | @@ -472,7 +480,7 @@ |
472 | 480 | .owner = THIS_MODULE, |
473 | 481 | .read = dsp56k_read, |
474 | 482 | .write = dsp56k_write, |
475 | - .ioctl = dsp56k_ioctl, | |
483 | + .unlocked_ioctl = dsp56k_ioctl, | |
476 | 484 | .open = dsp56k_open, |
477 | 485 | .release = dsp56k_release, |
478 | 486 | }; |