From 9be9cc827446e03ee670ab54363b28620e5521c5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 25 Jul 2008 01:48:17 -0700 Subject: [PATCH] --- yaml --- r: 105983 b: refs/heads/master c: 236b8756a2b6f90498d45b2c36d43e5372f2d4b8 h: refs/heads/master i: 105981: c8564d3ab1ba6a8e65c2fd331442527d01502c03 105979: d0d8c98dc4dcb2d28d2073401a910b3b0ee3ab1a 105975: b324ffd247c2985e3f72ae6386193e3bcdacf6fe 105967: d6c4c15239e103e7144fd3aed1119c9afcbcaa05 105951: 2bacdf3bc4c8848606dbf9bf25956c9a0cd582f2 105919: 5a10c770edc8bd3a0b23a0877eaf46ac2478853e 105855: 8eb1b1a5dd0ace9a1e487eba722c18483f5ea7fd 105727: bd744c028a94e53ba633f5b274e7d1a79af5f0f9 105471: dd6076418e8746619181b3b0a87240f37fe8caee v: v3 --- [refs] | 2 +- trunk/drivers/char/dsp56k.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 45343c5ef7a2..defb42f2f0c7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b8e35919653d76e7dceb8d3b8569c4ec1004d546 +refs/heads/master: 236b8756a2b6f90498d45b2c36d43e5372f2d4b8 diff --git a/trunk/drivers/char/dsp56k.c b/trunk/drivers/char/dsp56k.c index 33c466a4888f..19b88504e960 100644 --- a/trunk/drivers/char/dsp56k.c +++ b/trunk/drivers/char/dsp56k.c @@ -36,10 +36,10 @@ #include #include #include +#include /* For put_user and get_user */ #include #include -#include /* For put_user and get_user */ #include @@ -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, - unsigned int cmd, unsigned long arg) +static long dsp56k_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { int dev = iminor(inode) & 0x0f; 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) { return -EINVAL; } - + lock_kernel(); r = dsp56k_upload(bin, len); + unlock_kernel(); if (r < 0) { return r; } @@ -342,12 +343,16 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file, case DSP56K_SET_TX_WSIZE: if (arg > 4 || arg < 1) return -EINVAL; + lock_kernel(); dsp56k.tx_wsize = (int) arg; + unlock_kernel(); break; case DSP56K_SET_RX_WSIZE: if (arg > 4 || arg < 1) return -EINVAL; + lock_kernel(); dsp56k.rx_wsize = (int) arg; + unlock_kernel(); break; 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) return -EFAULT; + lock_kernel(); if ((dir & 0x1) && (out & 0x1)) dsp56k_host_interface.icr |= DSP56K_ICR_HF0; 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.isr & DSP56K_ISR_HF2) status |= 0x4; if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8; - + unlock_kernel(); return put_user(status, &hf->status); } case DSP56K_HOST_CMD: if (arg > 31 || arg < 0) return -EINVAL; + lock_kernel(); dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | DSP56K_CVR_HC); + unlock_kernel(); break; default: return -EINVAL; @@ -472,7 +480,7 @@ static const struct file_operations dsp56k_fops = { .owner = THIS_MODULE, .read = dsp56k_read, .write = dsp56k_write, - .ioctl = dsp56k_ioctl, + .unlocked_ioctl = dsp56k_ioctl, .open = dsp56k_open, .release = dsp56k_release, };