diff options
Diffstat (limited to 'drivers/char/dsp56k.c')
-rw-r--r-- | drivers/char/dsp56k.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 8a1b28a..b3c7562 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c @@ -32,7 +32,7 @@ #include <linux/mm.h> #include <linux/init.h> #include <linux/device.h> -#include <linux/smp_lock.h> +#include <linux/mutex.h> #include <linux/firmware.h> #include <linux/platform_device.h> #include <linux/uaccess.h> /* For put_user and get_user */ @@ -94,6 +94,7 @@ } \ } +static DEFINE_MUTEX(dsp56k_mutex); static struct dsp56k_device { unsigned long in_use; long maxio, timeout; @@ -330,9 +331,9 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, if (len > DSP56K_MAX_BINARY_LENGTH) { return -EINVAL; } - lock_kernel(); + mutex_lock(&dsp56k_mutex); r = dsp56k_upload(bin, len); - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); if (r < 0) { return r; } @@ -342,16 +343,16 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, case DSP56K_SET_TX_WSIZE: if (arg > 4 || arg < 1) return -EINVAL; - lock_kernel(); + mutex_lock(&dsp56k_mutex); dsp56k.tx_wsize = (int) arg; - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); break; case DSP56K_SET_RX_WSIZE: if (arg > 4 || arg < 1) return -EINVAL; - lock_kernel(); + mutex_lock(&dsp56k_mutex); dsp56k.rx_wsize = (int) arg; - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); break; case DSP56K_HOST_FLAGS: { @@ -363,7 +364,7 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, if(get_user(out, &hf->out) < 0) return -EFAULT; - lock_kernel(); + mutex_lock(&dsp56k_mutex); if ((dir & 0x1) && (out & 0x1)) dsp56k_host_interface.icr |= DSP56K_ICR_HF0; else if (dir & 0x1) @@ -378,16 +379,16 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, 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_HF3) status |= 0x8; - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); return put_user(status, &hf->status); } case DSP56K_HOST_CMD: if (arg > 31 || arg < 0) return -EINVAL; - lock_kernel(); + mutex_lock(&dsp56k_mutex); dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | DSP56K_CVR_HC); - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); break; default: return -EINVAL; @@ -427,7 +428,7 @@ static int dsp56k_open(struct inode *inode, struct file *file) int dev = iminor(inode) & 0x0f; int ret = 0; - lock_kernel(); + mutex_lock(&dsp56k_mutex); switch(dev) { case DSP56K_DEV_56001: @@ -454,7 +455,7 @@ static int dsp56k_open(struct inode *inode, struct file *file) ret = -ENODEV; } out: - unlock_kernel(); + mutex_unlock(&dsp56k_mutex); return ret; } |