mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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>
This commit is contained in:
parent
b8e3591965
commit
236b8756a2
1 changed files with 14 additions and 6 deletions
|
@ -36,10 +36,10 @@
|
||||||
#include <linux/smp_lock.h>
|
#include <linux/smp_lock.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/uaccess.h> /* For put_user and get_user */
|
||||||
|
|
||||||
#include <asm/atarihw.h>
|
#include <asm/atarihw.h>
|
||||||
#include <asm/traps.h>
|
#include <asm/traps.h>
|
||||||
#include <asm/uaccess.h> /* For put_user and get_user */
|
|
||||||
|
|
||||||
#include <asm/dsp56k.h>
|
#include <asm/dsp56k.h>
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsp56k_ioctl(struct inode *inode, struct file *file,
|
static long dsp56k_ioctl(struct file *file, unsigned int cmd,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int dev = iminor(inode) & 0x0f;
|
int dev = iminor(inode) & 0x0f;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
|
@ -331,8 +331,9 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
|
||||||
if (len > DSP56K_MAX_BINARY_LENGTH) {
|
if (len > DSP56K_MAX_BINARY_LENGTH) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
lock_kernel();
|
||||||
r = dsp56k_upload(bin, len);
|
r = dsp56k_upload(bin, len);
|
||||||
|
unlock_kernel();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -342,12 +343,16 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
|
||||||
case DSP56K_SET_TX_WSIZE:
|
case DSP56K_SET_TX_WSIZE:
|
||||||
if (arg > 4 || arg < 1)
|
if (arg > 4 || arg < 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
lock_kernel();
|
||||||
dsp56k.tx_wsize = (int) arg;
|
dsp56k.tx_wsize = (int) arg;
|
||||||
|
unlock_kernel();
|
||||||
break;
|
break;
|
||||||
case DSP56K_SET_RX_WSIZE:
|
case DSP56K_SET_RX_WSIZE:
|
||||||
if (arg > 4 || arg < 1)
|
if (arg > 4 || arg < 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
lock_kernel();
|
||||||
dsp56k.rx_wsize = (int) arg;
|
dsp56k.rx_wsize = (int) arg;
|
||||||
|
unlock_kernel();
|
||||||
break;
|
break;
|
||||||
case DSP56K_HOST_FLAGS:
|
case DSP56K_HOST_FLAGS:
|
||||||
{
|
{
|
||||||
|
@ -359,6 +364,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
|
||||||
if(get_user(out, &hf->out) < 0)
|
if(get_user(out, &hf->out) < 0)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
if ((dir & 0x1) && (out & 0x1))
|
if ((dir & 0x1) && (out & 0x1))
|
||||||
dsp56k_host_interface.icr |= DSP56K_ICR_HF0;
|
dsp56k_host_interface.icr |= DSP56K_ICR_HF0;
|
||||||
else if (dir & 0x1)
|
else if (dir & 0x1)
|
||||||
|
@ -373,14 +379,16 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
|
||||||
if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2;
|
if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2;
|
||||||
if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4;
|
if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4;
|
||||||
if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8;
|
if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8;
|
||||||
|
unlock_kernel();
|
||||||
return put_user(status, &hf->status);
|
return put_user(status, &hf->status);
|
||||||
}
|
}
|
||||||
case DSP56K_HOST_CMD:
|
case DSP56K_HOST_CMD:
|
||||||
if (arg > 31 || arg < 0)
|
if (arg > 31 || arg < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
lock_kernel();
|
||||||
dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) |
|
dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) |
|
||||||
DSP56K_CVR_HC);
|
DSP56K_CVR_HC);
|
||||||
|
unlock_kernel();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -472,7 +480,7 @@ static const struct file_operations dsp56k_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.read = dsp56k_read,
|
.read = dsp56k_read,
|
||||||
.write = dsp56k_write,
|
.write = dsp56k_write,
|
||||||
.ioctl = dsp56k_ioctl,
|
.unlocked_ioctl = dsp56k_ioctl,
|
||||||
.open = dsp56k_open,
|
.open = dsp56k_open,
|
||||||
.release = dsp56k_release,
|
.release = dsp56k_release,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue