mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
mwave: ioctl BKL pushdown
Push the BKL down to the point it wraps the actual mwave method handlers Signed-off-by: Alan Cox <alan@redhat.com> Cc: Eric Sesterhenn <snakebyte@gmx.de> Cc: Yani Ioannou <yani.ioannou@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
47be36a24d
commit
909d145f0d
1 changed files with 28 additions and 11 deletions
|
@ -86,8 +86,8 @@ module_param(mwave_uart_io, int, 0);
|
||||||
|
|
||||||
static int mwave_open(struct inode *inode, struct file *file);
|
static int mwave_open(struct inode *inode, struct file *file);
|
||||||
static int mwave_close(struct inode *inode, struct file *file);
|
static int mwave_close(struct inode *inode, struct file *file);
|
||||||
static int mwave_ioctl(struct inode *inode, struct file *filp,
|
static long mwave_ioctl(struct file *filp, unsigned int iocmd,
|
||||||
unsigned int iocmd, unsigned long ioarg);
|
unsigned long ioarg);
|
||||||
|
|
||||||
MWAVE_DEVICE_DATA mwave_s_mdd;
|
MWAVE_DEVICE_DATA mwave_s_mdd;
|
||||||
|
|
||||||
|
@ -119,16 +119,16 @@ static int mwave_close(struct inode *inode, struct file *file)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mwave_ioctl(struct inode *inode, struct file *file,
|
static long mwave_ioctl(struct file *file, unsigned int iocmd,
|
||||||
unsigned int iocmd, unsigned long ioarg)
|
unsigned long ioarg)
|
||||||
{
|
{
|
||||||
unsigned int retval = 0;
|
unsigned int retval = 0;
|
||||||
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
|
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
|
||||||
void __user *arg = (void __user *)ioarg;
|
void __user *arg = (void __user *)ioarg;
|
||||||
|
|
||||||
PRINTK_5(TRACE_MWAVE,
|
PRINTK_4(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, entry inode %p file %p cmd %x arg %x\n",
|
"mwavedd::mwave_ioctl, entry file %p cmd %x arg %x\n",
|
||||||
inode, file, iocmd, (int) ioarg);
|
file, iocmd, (int) ioarg);
|
||||||
|
|
||||||
switch (iocmd) {
|
switch (iocmd) {
|
||||||
|
|
||||||
|
@ -136,7 +136,9 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
PRINTK_1(TRACE_MWAVE,
|
PRINTK_1(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, IOCTL_MW_RESET"
|
"mwavedd::mwave_ioctl, IOCTL_MW_RESET"
|
||||||
" calling tp3780I_ResetDSP\n");
|
" calling tp3780I_ResetDSP\n");
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_ResetDSP(&pDrvData->rBDData);
|
retval = tp3780I_ResetDSP(&pDrvData->rBDData);
|
||||||
|
unlock_kernel();
|
||||||
PRINTK_2(TRACE_MWAVE,
|
PRINTK_2(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, IOCTL_MW_RESET"
|
"mwavedd::mwave_ioctl, IOCTL_MW_RESET"
|
||||||
" retval %x from tp3780I_ResetDSP\n",
|
" retval %x from tp3780I_ResetDSP\n",
|
||||||
|
@ -147,7 +149,9 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
PRINTK_1(TRACE_MWAVE,
|
PRINTK_1(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, IOCTL_MW_RUN"
|
"mwavedd::mwave_ioctl, IOCTL_MW_RUN"
|
||||||
" calling tp3780I_StartDSP\n");
|
" calling tp3780I_StartDSP\n");
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_StartDSP(&pDrvData->rBDData);
|
retval = tp3780I_StartDSP(&pDrvData->rBDData);
|
||||||
|
unlock_kernel();
|
||||||
PRINTK_2(TRACE_MWAVE,
|
PRINTK_2(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, IOCTL_MW_RUN"
|
"mwavedd::mwave_ioctl, IOCTL_MW_RUN"
|
||||||
" retval %x from tp3780I_StartDSP\n",
|
" retval %x from tp3780I_StartDSP\n",
|
||||||
|
@ -161,8 +165,10 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
"mwavedd::mwave_ioctl,"
|
"mwavedd::mwave_ioctl,"
|
||||||
" IOCTL_MW_DSP_ABILITIES calling"
|
" IOCTL_MW_DSP_ABILITIES calling"
|
||||||
" tp3780I_QueryAbilities\n");
|
" tp3780I_QueryAbilities\n");
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_QueryAbilities(&pDrvData->rBDData,
|
retval = tp3780I_QueryAbilities(&pDrvData->rBDData,
|
||||||
&rAbilities);
|
&rAbilities);
|
||||||
|
unlock_kernel();
|
||||||
PRINTK_2(TRACE_MWAVE,
|
PRINTK_2(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES"
|
"mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES"
|
||||||
" retval %x from tp3780I_QueryAbilities\n",
|
" retval %x from tp3780I_QueryAbilities\n",
|
||||||
|
@ -193,11 +199,13 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
"mwavedd::mwave_ioctl IOCTL_MW_READ_DATA,"
|
"mwavedd::mwave_ioctl IOCTL_MW_READ_DATA,"
|
||||||
" size %lx, ioarg %lx pusBuffer %p\n",
|
" size %lx, ioarg %lx pusBuffer %p\n",
|
||||||
rReadData.ulDataLength, ioarg, pusBuffer);
|
rReadData.ulDataLength, ioarg, pusBuffer);
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
||||||
iocmd,
|
iocmd,
|
||||||
pusBuffer,
|
pusBuffer,
|
||||||
rReadData.ulDataLength,
|
rReadData.ulDataLength,
|
||||||
rReadData.usDspAddress);
|
rReadData.usDspAddress);
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -215,10 +223,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
" size %lx, ioarg %lx pusBuffer %p\n",
|
" size %lx, ioarg %lx pusBuffer %p\n",
|
||||||
rReadData.ulDataLength / 2, ioarg,
|
rReadData.ulDataLength / 2, ioarg,
|
||||||
pusBuffer);
|
pusBuffer);
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
||||||
iocmd, pusBuffer,
|
iocmd, pusBuffer,
|
||||||
rReadData.ulDataLength / 2,
|
rReadData.ulDataLength / 2,
|
||||||
rReadData.usDspAddress);
|
rReadData.usDspAddress);
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -236,10 +246,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
" size %lx, ioarg %lx pusBuffer %p\n",
|
" size %lx, ioarg %lx pusBuffer %p\n",
|
||||||
rWriteData.ulDataLength, ioarg,
|
rWriteData.ulDataLength, ioarg,
|
||||||
pusBuffer);
|
pusBuffer);
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
|
||||||
iocmd, pusBuffer,
|
iocmd, pusBuffer,
|
||||||
rWriteData.ulDataLength,
|
rWriteData.ulDataLength,
|
||||||
rWriteData.usDspAddress);
|
rWriteData.usDspAddress);
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -257,10 +269,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
" size %lx, ioarg %lx pusBuffer %p\n",
|
" size %lx, ioarg %lx pusBuffer %p\n",
|
||||||
rWriteData.ulDataLength, ioarg,
|
rWriteData.ulDataLength, ioarg,
|
||||||
pusBuffer);
|
pusBuffer);
|
||||||
|
lock_kernel();
|
||||||
retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData,
|
retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData,
|
||||||
iocmd, pusBuffer,
|
iocmd, pusBuffer,
|
||||||
rWriteData.ulDataLength,
|
rWriteData.ulDataLength,
|
||||||
rWriteData.usDspAddress);
|
rWriteData.usDspAddress);
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -281,8 +295,10 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
ipcnum);
|
ipcnum);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
lock_kernel();
|
||||||
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
|
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
|
||||||
pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
|
pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
|
||||||
|
unlock_kernel();
|
||||||
|
|
||||||
PRINTK_2(TRACE_MWAVE,
|
PRINTK_2(TRACE_MWAVE,
|
||||||
"mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
|
"mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
|
||||||
|
@ -307,6 +323,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
|
|
||||||
|
@ -347,6 +364,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
" processing\n",
|
" processing\n",
|
||||||
ipcnum);
|
ipcnum);
|
||||||
}
|
}
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -365,19 +383,18 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
|
||||||
ipcnum);
|
ipcnum);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
lock_kernel();
|
||||||
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
||||||
pDrvData->IPCs[ipcnum].bIsEnabled = FALSE;
|
pDrvData->IPCs[ipcnum].bIsEnabled = FALSE;
|
||||||
if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) {
|
if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) {
|
||||||
wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue);
|
wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl:"
|
|
||||||
" Error: Unrecognized iocmd %x\n",
|
|
||||||
iocmd);
|
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
@ -460,7 +477,7 @@ static const struct file_operations mwave_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.read = mwave_read,
|
.read = mwave_read,
|
||||||
.write = mwave_write,
|
.write = mwave_write,
|
||||||
.ioctl = mwave_ioctl,
|
.unlocked_ioctl = mwave_ioctl,
|
||||||
.open = mwave_open,
|
.open = mwave_open,
|
||||||
.release = mwave_close
|
.release = mwave_close
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue