Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alan Cox and committed by
Linus Torvalds
909d145f 47be36a2

+28 -11
+28 -11
drivers/char/mwave/mwavedd.c
··· 86 86 87 87 static int mwave_open(struct inode *inode, struct file *file); 88 88 static int mwave_close(struct inode *inode, struct file *file); 89 - static int mwave_ioctl(struct inode *inode, struct file *filp, 90 - unsigned int iocmd, unsigned long ioarg); 89 + static long mwave_ioctl(struct file *filp, unsigned int iocmd, 90 + unsigned long ioarg); 91 91 92 92 MWAVE_DEVICE_DATA mwave_s_mdd; 93 93 ··· 119 119 return retval; 120 120 } 121 121 122 - static int mwave_ioctl(struct inode *inode, struct file *file, 123 - unsigned int iocmd, unsigned long ioarg) 122 + static long mwave_ioctl(struct file *file, unsigned int iocmd, 123 + unsigned long ioarg) 124 124 { 125 125 unsigned int retval = 0; 126 126 pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd; 127 127 void __user *arg = (void __user *)ioarg; 128 128 129 - PRINTK_5(TRACE_MWAVE, 130 - "mwavedd::mwave_ioctl, entry inode %p file %p cmd %x arg %x\n", 131 - inode, file, iocmd, (int) ioarg); 129 + PRINTK_4(TRACE_MWAVE, 130 + "mwavedd::mwave_ioctl, entry file %p cmd %x arg %x\n", 131 + file, iocmd, (int) ioarg); 132 132 133 133 switch (iocmd) { 134 134 ··· 136 136 PRINTK_1(TRACE_MWAVE, 137 137 "mwavedd::mwave_ioctl, IOCTL_MW_RESET" 138 138 " calling tp3780I_ResetDSP\n"); 139 + lock_kernel(); 139 140 retval = tp3780I_ResetDSP(&pDrvData->rBDData); 141 + unlock_kernel(); 140 142 PRINTK_2(TRACE_MWAVE, 141 143 "mwavedd::mwave_ioctl, IOCTL_MW_RESET" 142 144 " retval %x from tp3780I_ResetDSP\n", ··· 149 147 PRINTK_1(TRACE_MWAVE, 150 148 "mwavedd::mwave_ioctl, IOCTL_MW_RUN" 151 149 " calling tp3780I_StartDSP\n"); 150 + lock_kernel(); 152 151 retval = tp3780I_StartDSP(&pDrvData->rBDData); 152 + unlock_kernel(); 153 153 PRINTK_2(TRACE_MWAVE, 154 154 "mwavedd::mwave_ioctl, IOCTL_MW_RUN" 155 155 " retval %x from tp3780I_StartDSP\n", ··· 165 161 "mwavedd::mwave_ioctl," 166 162 " IOCTL_MW_DSP_ABILITIES calling" 167 163 " tp3780I_QueryAbilities\n"); 164 + lock_kernel(); 168 165 retval = tp3780I_QueryAbilities(&pDrvData->rBDData, 169 166 &rAbilities); 167 + unlock_kernel(); 170 168 PRINTK_2(TRACE_MWAVE, 171 169 "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES" 172 170 " retval %x from tp3780I_QueryAbilities\n", ··· 199 193 "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA," 200 194 " size %lx, ioarg %lx pusBuffer %p\n", 201 195 rReadData.ulDataLength, ioarg, pusBuffer); 196 + lock_kernel(); 202 197 retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, 203 198 iocmd, 204 199 pusBuffer, 205 200 rReadData.ulDataLength, 206 201 rReadData.usDspAddress); 202 + unlock_kernel(); 207 203 } 208 204 break; 209 205 ··· 223 215 " size %lx, ioarg %lx pusBuffer %p\n", 224 216 rReadData.ulDataLength / 2, ioarg, 225 217 pusBuffer); 218 + lock_kernel(); 226 219 retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, 227 220 iocmd, pusBuffer, 228 221 rReadData.ulDataLength / 2, 229 222 rReadData.usDspAddress); 223 + unlock_kernel(); 230 224 } 231 225 break; 232 226 ··· 246 236 " size %lx, ioarg %lx pusBuffer %p\n", 247 237 rWriteData.ulDataLength, ioarg, 248 238 pusBuffer); 239 + lock_kernel(); 249 240 retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, 250 241 iocmd, pusBuffer, 251 242 rWriteData.ulDataLength, 252 243 rWriteData.usDspAddress); 244 + unlock_kernel(); 253 245 } 254 246 break; 255 247 ··· 269 257 " size %lx, ioarg %lx pusBuffer %p\n", 270 258 rWriteData.ulDataLength, ioarg, 271 259 pusBuffer); 260 + lock_kernel(); 272 261 retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData, 273 262 iocmd, pusBuffer, 274 263 rWriteData.ulDataLength, 275 264 rWriteData.usDspAddress); 265 + unlock_kernel(); 276 266 } 277 267 break; 278 268 ··· 295 281 ipcnum); 296 282 return -EINVAL; 297 283 } 284 + lock_kernel(); 298 285 pDrvData->IPCs[ipcnum].bIsHere = FALSE; 299 286 pDrvData->IPCs[ipcnum].bIsEnabled = TRUE; 287 + unlock_kernel(); 300 288 301 289 PRINTK_2(TRACE_MWAVE, 302 290 "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" ··· 323 307 return -EINVAL; 324 308 } 325 309 310 + lock_kernel(); 326 311 if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { 327 312 DECLARE_WAITQUEUE(wait, current); 328 313 ··· 364 347 " processing\n", 365 348 ipcnum); 366 349 } 350 + unlock_kernel(); 367 351 } 368 352 break; 369 353 ··· 383 365 ipcnum); 384 366 return -EINVAL; 385 367 } 368 + lock_kernel(); 386 369 if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { 387 370 pDrvData->IPCs[ipcnum].bIsEnabled = FALSE; 388 371 if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) { 389 372 wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue); 390 373 } 391 374 } 375 + unlock_kernel(); 392 376 } 393 377 break; 394 378 395 379 default: 396 - PRINTK_ERROR(KERN_ERR_MWAVE "mwavedd::mwave_ioctl:" 397 - " Error: Unrecognized iocmd %x\n", 398 - iocmd); 399 380 return -ENOTTY; 400 381 break; 401 382 } /* switch */ ··· 477 460 .owner = THIS_MODULE, 478 461 .read = mwave_read, 479 462 .write = mwave_write, 480 - .ioctl = mwave_ioctl, 463 + .unlocked_ioctl = mwave_ioctl, 481 464 .open = mwave_open, 482 465 .release = mwave_close 483 466 };