aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorBill Pemberton <wfp5p@virginia.edu>2009-03-16 22:04:23 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 17:53:54 -0400
commit82675f3547ba2a0732beabd9bb4393535f74408c (patch)
tree91142ea65d09dfad30643af5988d0a46ed89f23c /drivers/staging/comedi
parentdedd1325f1d53e2a2604457c4b3af9e62dde5001 (diff)
Staging: comedi: Remove curly braces where they are not needed
Changes as suggested by checkpatch.pl. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/comedi_compat32.c50
-rw-r--r--drivers/staging/comedi/drivers/icp_multi.c3
-rw-r--r--drivers/staging/comedi/drivers/me4000.c44
-rw-r--r--drivers/staging/comedi/drivers/mite.c19
-rw-r--r--drivers/staging/comedi/drivers/plx9080.h4
-rw-r--r--drivers/staging/comedi/drivers/s626.c16
-rw-r--r--drivers/staging/comedi/kcomedilib/get.c4
-rw-r--r--drivers/staging/comedi/kcomedilib/kcomedilib_main.c35
-rw-r--r--drivers/staging/comedi/proc.c6
-rw-r--r--drivers/staging/comedi/range.c3
-rw-r--r--drivers/staging/comedi/rt.c4
11 files changed, 80 insertions, 108 deletions
diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c
index 98e570a2cb3..7f5a86903c6 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -98,15 +98,14 @@ typedef struct comedi32_insnlist_struct {
98static int translated_ioctl(struct file *file, unsigned int cmd, 98static int translated_ioctl(struct file *file, unsigned int cmd,
99 unsigned long arg) 99 unsigned long arg)
100{ 100{
101 if (!file->f_op) { 101 if (!file->f_op)
102 return -ENOTTY; 102 return -ENOTTY;
103 } 103
104#ifdef HAVE_UNLOCKED_IOCTL 104#ifdef HAVE_UNLOCKED_IOCTL
105 if (file->f_op->unlocked_ioctl) { 105 if (file->f_op->unlocked_ioctl) {
106 int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg); 106 int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg);
107 if (rc == -ENOIOCTLCMD) { 107 if (rc == -ENOIOCTLCMD)
108 rc = -ENOTTY; 108 rc = -ENOTTY;
109 }
110 return rc; 109 return rc;
111 } 110 }
112#endif 111#endif
@@ -150,9 +149,8 @@ static int compat_chaninfo(struct file *file, unsigned long arg)
150 err |= __put_user(compat_ptr(temp.uptr), &chaninfo->flaglist); 149 err |= __put_user(compat_ptr(temp.uptr), &chaninfo->flaglist);
151 err |= __get_user(temp.uptr, &chaninfo32->rangelist); 150 err |= __get_user(temp.uptr, &chaninfo32->rangelist);
152 err |= __put_user(compat_ptr(temp.uptr), &chaninfo->rangelist); 151 err |= __put_user(compat_ptr(temp.uptr), &chaninfo->rangelist);
153 if (err) { 152 if (err)
154 return -EFAULT; 153 return -EFAULT;
155 }
156 154
157 return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo); 155 return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo);
158} 156}
@@ -182,9 +180,8 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
182 err |= __put_user(temp.uint, &rangeinfo->range_type); 180 err |= __put_user(temp.uint, &rangeinfo->range_type);
183 err |= __get_user(temp.uptr, &rangeinfo32->range_ptr); 181 err |= __get_user(temp.uptr, &rangeinfo32->range_ptr);
184 err |= __put_user(compat_ptr(temp.uptr), &rangeinfo->range_ptr); 182 err |= __put_user(compat_ptr(temp.uptr), &rangeinfo->range_ptr);
185 if (err) { 183 if (err)
186 return -EFAULT; 184 return -EFAULT;
187 }
188 185
189 return translated_ioctl(file, COMEDI_RANGEINFO, 186 return translated_ioctl(file, COMEDI_RANGEINFO,
190 (unsigned long)rangeinfo); 187 (unsigned long)rangeinfo);
@@ -300,9 +297,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
300 cmd = compat_alloc_user_space(sizeof(*cmd)); 297 cmd = compat_alloc_user_space(sizeof(*cmd));
301 298
302 rc = get_compat_cmd(cmd, cmd32); 299 rc = get_compat_cmd(cmd, cmd32);
303 if (rc) { 300 if (rc)
304 return rc; 301 return rc;
305 }
306 302
307 return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); 303 return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
308} 304}
@@ -318,19 +314,17 @@ static int compat_cmdtest(struct file *file, unsigned long arg)
318 cmd = compat_alloc_user_space(sizeof(*cmd)); 314 cmd = compat_alloc_user_space(sizeof(*cmd));
319 315
320 rc = get_compat_cmd(cmd, cmd32); 316 rc = get_compat_cmd(cmd, cmd32);
321 if (rc) { 317 if (rc)
322 return rc; 318 return rc;
323 }
324 319
325 rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd); 320 rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd);
326 if (rc < 0) { 321 if (rc < 0)
327 return rc; 322 return rc;
328 }
329 323
330 err = put_compat_cmd(cmd32, cmd); 324 err = put_compat_cmd(cmd32, cmd);
331 if (err) { 325 if (err)
332 rc = err; 326 rc = err;
333 } 327
334 return rc; 328 return rc;
335} 329}
336 330
@@ -347,9 +341,9 @@ static int get_compat_insn(comedi_insn __user *insn,
347 /* Copy insn structure. Ignore the unused members. */ 341 /* Copy insn structure. Ignore the unused members. */
348 err = 0; 342 err = 0;
349 if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32)) 343 if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32))
350 || !access_ok(VERIFY_WRITE, insn, sizeof(*insn))) { 344 || !access_ok(VERIFY_WRITE, insn, sizeof(*insn)))
351 return -EFAULT; 345 return -EFAULT;
352 } 346
353 err |= __get_user(temp.uint, &insn32->insn); 347 err |= __get_user(temp.uint, &insn32->insn);
354 err |= __put_user(temp.uint, &insn->insn); 348 err |= __put_user(temp.uint, &insn->insn);
355 err |= __get_user(temp.uint, &insn32->n); 349 err |= __get_user(temp.uint, &insn32->n);
@@ -386,9 +380,8 @@ static int compat_insnlist(struct file *file, unsigned long arg)
386 err |= __get_user(n_insns, &insnlist32->n_insns); 380 err |= __get_user(n_insns, &insnlist32->n_insns);
387 err |= __get_user(uptr, &insnlist32->insns); 381 err |= __get_user(uptr, &insnlist32->insns);
388 insn32 = compat_ptr(uptr); 382 insn32 = compat_ptr(uptr);
389 if (err) { 383 if (err)
390 return -EFAULT; 384 return -EFAULT;
391 }
392 385
393 /* Allocate user memory to copy insnlist and insns into. */ 386 /* Allocate user memory to copy insnlist and insns into. */
394 s = compat_alloc_user_space(offsetof(struct combined_insnlist, 387 s = compat_alloc_user_space(offsetof(struct combined_insnlist,
@@ -400,16 +393,14 @@ static int compat_insnlist(struct file *file, unsigned long arg)
400 } 393 }
401 err |= __put_user(n_insns, &s->insnlist.n_insns); 394 err |= __put_user(n_insns, &s->insnlist.n_insns);
402 err |= __put_user(&s->insn[0], &s->insnlist.insns); 395 err |= __put_user(&s->insn[0], &s->insnlist.insns);
403 if (err) { 396 if (err)
404 return -EFAULT; 397 return -EFAULT;
405 }
406 398
407 /* Copy insn structures. */ 399 /* Copy insn structures. */
408 for (n = 0; n < n_insns; n++) { 400 for (n = 0; n < n_insns; n++) {
409 rc = get_compat_insn(&s->insn[n], &insn32[n]); 401 rc = get_compat_insn(&s->insn[n], &insn32[n]);
410 if (rc) { 402 if (rc)
411 return rc; 403 return rc;
412 }
413 } 404 }
414 405
415 return translated_ioctl(file, COMEDI_INSNLIST, 406 return translated_ioctl(file, COMEDI_INSNLIST,
@@ -427,9 +418,8 @@ static int compat_insn(struct file *file, unsigned long arg)
427 insn = compat_alloc_user_space(sizeof(*insn)); 418 insn = compat_alloc_user_space(sizeof(*insn));
428 419
429 rc = get_compat_insn(insn, insn32); 420 rc = get_compat_insn(insn, insn32);
430 if (rc) { 421 if (rc)
431 return rc; 422 return rc;
432 }
433 423
434 return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn); 424 return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
435} 425}
@@ -512,14 +502,14 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
512 int rc; 502 int rc;
513 503
514 /* Make sure we are dealing with a Comedi device. */ 504 /* Make sure we are dealing with a Comedi device. */
515 if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR) { 505 if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR)
516 return -ENOTTY; 506 return -ENOTTY;
517 } 507
518 rc = raw_ioctl(file, cmd, arg); 508 rc = raw_ioctl(file, cmd, arg);
519 /* Do not return -ENOIOCTLCMD. */ 509 /* Do not return -ENOIOCTLCMD. */
520 if (rc == -ENOIOCTLCMD) { 510 if (rc == -ENOIOCTLCMD)
521 rc = -ENOTTY; 511 rc = -ENOTTY;
522 } 512
523 return rc; 513 return rc;
524} 514}
525 515
diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c
index 9603d9e24d3..d9ff5687448 100644
--- a/drivers/staging/comedi/drivers/icp_multi.c
+++ b/drivers/staging/comedi/drivers/icp_multi.c
@@ -1080,9 +1080,8 @@ static int icp_multi_detach(comedi_device *dev)
1080 if (dev->private && devpriv->card) 1080 if (dev->private && devpriv->card)
1081 pci_card_free(devpriv->card); 1081 pci_card_free(devpriv->card);
1082 1082
1083 if (--pci_list_builded == 0) { 1083 if (--pci_list_builded == 0)
1084 pci_card_list_cleanup(PCI_VENDOR_ID_ICP); 1084 pci_card_list_cleanup(PCI_VENDOR_ID_ICP);
1085 }
1086 1085
1087 return 0; 1086 return 0;
1088} 1087}
diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index c1f10b89a83..5f6e77cceb6 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -378,9 +378,9 @@ static int me4000_probe(comedi_device *dev, comedi_devconfig *it)
378 CALL_PDEBUG("In me4000_probe()\n"); 378 CALL_PDEBUG("In me4000_probe()\n");
379 379
380 /* Allocate private memory */ 380 /* Allocate private memory */
381 if (alloc_private(dev, sizeof(me4000_info_t)) < 0) { 381 if (alloc_private(dev, sizeof(me4000_info_t)) < 0)
382 return -ENOMEM; 382 return -ENOMEM;
383 } 383
384 /* 384 /*
385 * Probe the device to determine what device in the series it is. 385 * Probe the device to determine what device in the series it is.
386 */ 386 */
@@ -576,15 +576,13 @@ static int init_board_info(comedi_device *dev, struct pci_dev *pci_dev_p)
576 576
577 /* Get the serial number */ 577 /* Get the serial number */
578 result = pci_read_config_dword(pci_dev_p, 0x2C, &info->serial_no); 578 result = pci_read_config_dword(pci_dev_p, 0x2C, &info->serial_no);
579 if (result != PCIBIOS_SUCCESSFUL) { 579 if (result != PCIBIOS_SUCCESSFUL)
580 return result; 580 return result;
581 }
582 581
583 /* Get the hardware revision */ 582 /* Get the hardware revision */
584 result = pci_read_config_byte(pci_dev_p, 0x08, &info->hw_revision); 583 result = pci_read_config_byte(pci_dev_p, 0x08, &info->hw_revision);
585 if (result != PCIBIOS_SUCCESSFUL) { 584 if (result != PCIBIOS_SUCCESSFUL)
586 return result; 585 return result;
587 }
588 586
589 /* Get the vendor id */ 587 /* Get the vendor id */
590 info->vendor_id = pci_dev_p->vendor; 588 info->vendor_id = pci_dev_p->vendor;
@@ -902,9 +900,8 @@ static int me4000_detach(comedi_device *dev)
902 if (info) { 900 if (info) {
903 if (info->pci_dev_p) { 901 if (info->pci_dev_p) {
904 reset_board(dev); 902 reset_board(dev);
905 if (info->plx_regbase) { 903 if (info->plx_regbase)
906 comedi_pci_disable(info->pci_dev_p); 904 comedi_pci_disable(info->pci_dev_p);
907 }
908 pci_dev_put(info->pci_dev_p); 905 pci_dev_put(info->pci_dev_p);
909 } 906 }
910 } 907 }
@@ -1163,9 +1160,8 @@ static int ai_round_cmd_args(comedi_device *dev,
1163 rest = (cmd->start_arg * 33) % 1000; 1160 rest = (cmd->start_arg * 33) % 1000;
1164 1161
1165 if (cmd->flags & TRIG_ROUND_NEAREST) { 1162 if (cmd->flags & TRIG_ROUND_NEAREST) {
1166 if (rest > 33) { 1163 if (rest > 33)
1167 (*init_ticks)++; 1164 (*init_ticks)++;
1168 }
1169 } else if (cmd->flags & TRIG_ROUND_UP) { 1165 } else if (cmd->flags & TRIG_ROUND_UP) {
1170 if (rest) 1166 if (rest)
1171 (*init_ticks)++; 1167 (*init_ticks)++;
@@ -1177,9 +1173,8 @@ static int ai_round_cmd_args(comedi_device *dev,
1177 rest = (cmd->scan_begin_arg * 33) % 1000; 1173 rest = (cmd->scan_begin_arg * 33) % 1000;
1178 1174
1179 if (cmd->flags & TRIG_ROUND_NEAREST) { 1175 if (cmd->flags & TRIG_ROUND_NEAREST) {
1180 if (rest > 33) { 1176 if (rest > 33)
1181 (*scan_ticks)++; 1177 (*scan_ticks)++;
1182 }
1183 } else if (cmd->flags & TRIG_ROUND_UP) { 1178 } else if (cmd->flags & TRIG_ROUND_UP) {
1184 if (rest) 1179 if (rest)
1185 (*scan_ticks)++; 1180 (*scan_ticks)++;
@@ -1191,9 +1186,8 @@ static int ai_round_cmd_args(comedi_device *dev,
1191 rest = (cmd->convert_arg * 33) % 1000; 1186 rest = (cmd->convert_arg * 33) % 1000;
1192 1187
1193 if (cmd->flags & TRIG_ROUND_NEAREST) { 1188 if (cmd->flags & TRIG_ROUND_NEAREST) {
1194 if (rest > 33) { 1189 if (rest > 33)
1195 (*chan_ticks)++; 1190 (*chan_ticks)++;
1196 }
1197 } else if (cmd->flags & TRIG_ROUND_UP) { 1191 } else if (cmd->flags & TRIG_ROUND_UP) {
1198 if (rest) 1192 if (rest)
1199 (*chan_ticks)++; 1193 (*chan_ticks)++;
@@ -1503,9 +1497,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
1503 cmd->stop_src = TRIG_NONE; 1497 cmd->stop_src = TRIG_NONE;
1504 err++; 1498 err++;
1505 } 1499 }
1506 if (err) { 1500 if (err)
1507 return 1; 1501 return 1;
1508 }
1509 1502
1510 /* 1503 /*
1511 * Stage 2. Check for trigger source conflicts. 1504 * Stage 2. Check for trigger source conflicts.
@@ -1553,9 +1546,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
1553 cmd->scan_end_src = TRIG_NONE; 1546 cmd->scan_end_src = TRIG_NONE;
1554 err++; 1547 err++;
1555 } 1548 }
1556 if (err) { 1549 if (err)
1557 return 2; 1550 return 2;
1558 }
1559 1551
1560 /* 1552 /*
1561 * Stage 3. Check if arguments are generally valid. 1553 * Stage 3. Check if arguments are generally valid.
@@ -1588,9 +1580,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
1588 cmd->convert_arg = 2000; 1580 cmd->convert_arg = 2000;
1589 err++; 1581 err++;
1590 } 1582 }
1591 if (err) { 1583
1584 if (err)
1592 return 3; 1585 return 3;
1593 }
1594 1586
1595 /* 1587 /*
1596 * Stage 4. Check for argument conflicts. 1588 * Stage 4. Check for argument conflicts.
@@ -1735,9 +1727,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
1735 err++; 1727 err++;
1736 } 1728 }
1737 } 1729 }
1738 if (err) { 1730
1731 if (err)
1739 return 4; 1732 return 4;
1740 }
1741 1733
1742 /* 1734 /*
1743 * Stage 5. Check the channel list. 1735 * Stage 5. Check the channel list.
@@ -1997,9 +1989,9 @@ static int me4000_dio_insn_bits(comedi_device *dev,
1997 CALL_PDEBUG("In me4000_dio_insn_bits()\n"); 1989 CALL_PDEBUG("In me4000_dio_insn_bits()\n");
1998 1990
1999 /* Length of data must be 2 (mask and new data, see below) */ 1991 /* Length of data must be 2 (mask and new data, see below) */
2000 if (insn->n == 0) { 1992 if (insn->n == 0)
2001 return 0; 1993 return 0;
2002 } 1994
2003 if (insn->n != 2) { 1995 if (insn->n != 2) {
2004 printk("comedi%d: me4000: me4000_dio_insn_bits(): Invalid instruction length\n", dev->minor); 1996 printk("comedi%d: me4000: me4000_dio_insn_bits(): Invalid instruction length\n", dev->minor);
2005 return -EINVAL; 1997 return -EINVAL;
@@ -2274,9 +2266,9 @@ static int me4000_cnt_insn_read(comedi_device *dev,
2274 2266
2275 CALL_PDEBUG("In me4000_cnt_insn_read()\n"); 2267 CALL_PDEBUG("In me4000_cnt_insn_read()\n");
2276 2268
2277 if (insn->n == 0) { 2269 if (insn->n == 0)
2278 return 0; 2270 return 0;
2279 } 2271
2280 if (insn->n > 1) { 2272 if (insn->n > 1) {
2281 printk(KERN_ERR 2273 printk(KERN_ERR
2282 "comedi%d: me4000: me4000_cnt_insn_read(): Invalid instruction length %d\n", 2274 "comedi%d: me4000: me4000_cnt_insn_read(): Invalid instruction length %d\n",
diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index c7fe073f27b..e0e2d6c90ac 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -331,9 +331,9 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, comedi_async * async)
331 ring->descriptors_dma_addr = 0; 331 ring->descriptors_dma_addr = 0;
332 ring->n_links = 0; 332 ring->n_links = 0;
333 333
334 if (async->prealloc_bufsz == 0) { 334 if (async->prealloc_bufsz == 0)
335 return 0; 335 return 0;
336 } 336
337 n_links = async->prealloc_bufsz >> PAGE_SHIFT; 337 n_links = async->prealloc_bufsz >> PAGE_SHIFT;
338 338
339 MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links); 339 MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links);
@@ -395,9 +395,9 @@ void mite_prep_dma(struct mite_channel *mite_chan,
395 on e-series boards. */ 395 on e-series boards. */
396 chcr |= CHCR_BYTE_SWAP_DEVICE | CHCR_BYTE_SWAP_MEMORY; 396 chcr |= CHCR_BYTE_SWAP_DEVICE | CHCR_BYTE_SWAP_MEMORY;
397 } 397 }
398 if (mite_chan->dir == COMEDI_INPUT) { 398 if (mite_chan->dir == COMEDI_INPUT)
399 chcr |= CHCR_DEV_TO_MEM; 399 chcr |= CHCR_DEV_TO_MEM;
400 } 400
401 writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel)); 401 writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel));
402 402
403 /* to/from memory */ 403 /* to/from memory */
@@ -547,9 +547,9 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, comedi_async * async)
547 count = nbytes - async->buf_write_count; 547 count = nbytes - async->buf_write_count;
548 /* it's possible count will be negative due to 548 /* it's possible count will be negative due to
549 * conservative value returned by mite_bytes_written_to_memory_lb */ 549 * conservative value returned by mite_bytes_written_to_memory_lb */
550 if (count <= 0) { 550 if (count <= 0)
551 return 0; 551 return 0;
552 } 552
553 comedi_buf_write_free(async, count); 553 comedi_buf_write_free(async, count);
554 554
555 async->scan_progress += count; 555 async->scan_progress += count;
@@ -586,9 +586,9 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, comedi_async * async)
586 return -1; 586 return -1;
587 } 587 }
588 count = nbytes_lb - async->buf_read_count; 588 count = nbytes_lb - async->buf_read_count;
589 if (count <= 0) { 589 if (count <= 0)
590 return 0; 590 return 0;
591 } 591
592 if (count) { 592 if (count) {
593 comedi_buf_read_free(async, count); 593 comedi_buf_read_free(async, count);
594 async->events |= COMEDI_CB_BLOCK; 594 async->events |= COMEDI_CB_BLOCK;
@@ -753,9 +753,8 @@ static void mite_decode(char **bit_str, unsigned int bits)
753 int i; 753 int i;
754 754
755 for (i = 31; i >= 0; i--) { 755 for (i = 31; i >= 0; i--) {
756 if (bits & (1 << i)) { 756 if (bits & (1 << i))
757 printk(" %s", bit_str[i]); 757 printk(" %s", bit_str[i]);
758 }
759 } 758 }
760 printk("\n"); 759 printk("\n");
761} 760}
diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h
index e53d3d429d7..9231ba80203 100644
--- a/drivers/staging/comedi/drivers/plx9080.h
+++ b/drivers/staging/comedi/drivers/plx9080.h
@@ -394,9 +394,9 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel)
394 394
395 /* abort dma transfer if necessary */ 395 /* abort dma transfer if necessary */
396 dma_status = readb(dma_cs_addr); 396 dma_status = readb(dma_cs_addr);
397 if ((dma_status & PLX_DMA_EN_BIT) == 0) { 397 if ((dma_status & PLX_DMA_EN_BIT) == 0)
398 return 0; 398 return 0;
399 } 399
400 /* wait to make sure done bit is zero */ 400 /* wait to make sure done bit is zero */
401 for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) { 401 for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) {
402 comedi_udelay(1); 402 comedi_udelay(1);
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 22b1e72a9f7..d447f466d33 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1290,18 +1290,15 @@ static int s626_detach(comedi_device *dev)
1290 CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE); 1290 CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE);
1291 } 1291 }
1292 1292
1293 if (dev->irq) { 1293 if (dev->irq)
1294 comedi_free_irq(dev->irq, dev); 1294 comedi_free_irq(dev->irq, dev);
1295 }
1296 1295
1297 if (devpriv->base_addr) { 1296 if (devpriv->base_addr)
1298 iounmap(devpriv->base_addr); 1297 iounmap(devpriv->base_addr);
1299 }
1300 1298
1301 if (devpriv->pdev) { 1299 if (devpriv->pdev) {
1302 if (devpriv->got_regions) { 1300 if (devpriv->got_regions)
1303 comedi_pci_disable(devpriv->pdev); 1301 comedi_pci_disable(devpriv->pdev);
1304 }
1305 pci_dev_put(devpriv->pdev); 1302 pci_dev_put(devpriv->pdev);
1306 } 1303 }
1307 } 1304 }
@@ -2072,9 +2069,8 @@ static int s626_ao_rinsn(comedi_device *dev, comedi_subdevice *s,
2072{ 2069{
2073 int i; 2070 int i;
2074 2071
2075 for (i = 0; i < insn->n; i++) { 2072 for (i = 0; i < insn->n; i++)
2076 data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; 2073 data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
2077 }
2078 2074
2079 return i; 2075 return i;
2080} 2076}
@@ -2119,9 +2115,9 @@ static int s626_dio_insn_bits(comedi_device *dev, comedi_subdevice *s,
2119{ 2115{
2120 2116
2121 /* Length of data must be 2 (mask and new data, see below) */ 2117 /* Length of data must be 2 (mask and new data, see below) */
2122 if (insn->n == 0) { 2118 if (insn->n == 0)
2123 return 0; 2119 return 0;
2124 } 2120
2125 if (insn->n != 2) { 2121 if (insn->n != 2) {
2126 printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor); 2122 printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor);
2127 return -EINVAL; 2123 return -EINVAL;
diff --git a/drivers/staging/comedi/kcomedilib/get.c b/drivers/staging/comedi/kcomedilib/get.c
index 781733787e9..36778b30f39 100644
--- a/drivers/staging/comedi/kcomedilib/get.c
+++ b/drivers/staging/comedi/kcomedilib/get.c
@@ -160,9 +160,9 @@ int comedi_get_krange(comedi_t *d, unsigned int subdevice, unsigned int chan,
160 } else { 160 } else {
161 lr = s->range_table; 161 lr = s->range_table;
162 } 162 }
163 if (range >= lr->length) { 163 if (range >= lr->length)
164 return -EINVAL; 164 return -EINVAL;
165 } 165
166 memcpy(krange, lr->range + range, sizeof(comedi_krange)); 166 memcpy(krange, lr->range + range, sizeof(comedi_krange));
167 167
168 return 0; 168 return 0;
diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c
index 94a5067f6bd..7818e391dca 100644
--- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c
+++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c
@@ -331,9 +331,9 @@ int comedi_lock(comedi_t *d, unsigned int subdevice)
331 unsigned long flags; 331 unsigned long flags;
332 int ret = 0; 332 int ret = 0;
333 333
334 if (subdevice >= dev->n_subdevices) { 334 if (subdevice >= dev->n_subdevices)
335 return -EINVAL; 335 return -EINVAL;
336 } 336
337 s = dev->subdevices + subdevice; 337 s = dev->subdevices + subdevice;
338 338
339 comedi_spin_lock_irqsave(&s->spin_lock, flags); 339 comedi_spin_lock_irqsave(&s->spin_lock, flags);
@@ -375,9 +375,9 @@ int comedi_unlock(comedi_t *d, unsigned int subdevice)
375 comedi_async *async; 375 comedi_async *async;
376 int ret; 376 int ret;
377 377
378 if (subdevice >= dev->n_subdevices) { 378 if (subdevice >= dev->n_subdevices)
379 return -EINVAL; 379 return -EINVAL;
380 } 380
381 s = dev->subdevices + subdevice; 381 s = dev->subdevices + subdevice;
382 382
383 async = s->async; 383 async = s->async;
@@ -425,9 +425,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
425 comedi_subdevice *s; 425 comedi_subdevice *s;
426 int ret = 0; 426 int ret = 0;
427 427
428 if (subdevice >= dev->n_subdevices) { 428 if (subdevice >= dev->n_subdevices)
429 return -EINVAL; 429 return -EINVAL;
430 } 430
431 s = dev->subdevices + subdevice; 431 s = dev->subdevices + subdevice;
432 432
433 if (s->lock && s->lock != d) 433 if (s->lock && s->lock != d)
@@ -450,9 +450,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
450 return ret; 450 return ret;
451 451
452#ifdef CONFIG_COMEDI_RT 452#ifdef CONFIG_COMEDI_RT
453 if (comedi_get_subdevice_runflags(s) & SRF_RT) { 453 if (comedi_get_subdevice_runflags(s) & SRF_RT)
454 comedi_switch_to_non_rt(dev); 454 comedi_switch_to_non_rt(dev);
455 } 455
456#endif 456#endif
457 comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0); 457 comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0);
458 s->async->inttrig = NULL; 458 s->async->inttrig = NULL;
@@ -471,9 +471,9 @@ int comedi_register_callback(comedi_t *d, unsigned int subdevice,
471 comedi_subdevice *s; 471 comedi_subdevice *s;
472 comedi_async *async; 472 comedi_async *async;
473 473
474 if (subdevice >= dev->n_subdevices) { 474 if (subdevice >= dev->n_subdevices)
475 return -EINVAL; 475 return -EINVAL;
476 } 476
477 s = dev->subdevices + subdevice; 477 s = dev->subdevices + subdevice;
478 478
479 async = s->async; 479 async = s->async;
@@ -507,9 +507,9 @@ int comedi_poll(comedi_t *d, unsigned int subdevice)
507 comedi_subdevice *s = dev->subdevices; 507 comedi_subdevice *s = dev->subdevices;
508 comedi_async *async; 508 comedi_async *async;
509 509
510 if (subdevice >= dev->n_subdevices) { 510 if (subdevice >= dev->n_subdevices)
511 return -EINVAL; 511 return -EINVAL;
512 } 512
513 s = dev->subdevices + subdevice; 513 s = dev->subdevices + subdevice;
514 514
515 async = s->async; 515 async = s->async;
@@ -533,17 +533,16 @@ int comedi_map(comedi_t *d, unsigned int subdevice, void *ptr)
533 comedi_device *dev = (comedi_device *) d; 533 comedi_device *dev = (comedi_device *) d;
534 comedi_subdevice *s; 534 comedi_subdevice *s;
535 535
536 if (subdevice >= dev->n_subdevices) { 536 if (subdevice >= dev->n_subdevices)
537 return -EINVAL; 537 return -EINVAL;
538 } 538
539 s = dev->subdevices + subdevice; 539 s = dev->subdevices + subdevice;
540 540
541 if (!s->async) 541 if (!s->async)
542 return -EINVAL; 542 return -EINVAL;
543 543
544 if (ptr) { 544 if (ptr)
545 *((void **)ptr) = s->async->prealloc_buf; 545 *((void **)ptr) = s->async->prealloc_buf;
546 }
547 546
548 /* XXX no reference counting */ 547 /* XXX no reference counting */
549 548
@@ -556,9 +555,9 @@ int comedi_unmap(comedi_t *d, unsigned int subdevice)
556 comedi_device *dev = (comedi_device *) d; 555 comedi_device *dev = (comedi_device *) d;
557 comedi_subdevice *s; 556 comedi_subdevice *s;
558 557
559 if (subdevice >= dev->n_subdevices) { 558 if (subdevice >= dev->n_subdevices)
560 return -EINVAL; 559 return -EINVAL;
561 } 560
562 s = dev->subdevices + subdevice; 561 s = dev->subdevices + subdevice;
563 562
564 if (!s->async) 563 if (!s->async)
diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c
index 3f61828294f..6a1efa86ae9 100644
--- a/drivers/staging/comedi/proc.c
+++ b/drivers/staging/comedi/proc.c
@@ -67,9 +67,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
67 dev->board_name, dev->n_subdevices); 67 dev->board_name, dev->n_subdevices);
68 } 68 }
69 } 69 }
70 if (!devices_q) { 70 if (!devices_q)
71 l += sprintf(buf + l, "no devices\n"); 71 l += sprintf(buf + l, "no devices\n");
72 }
73 72
74 for (driv = comedi_drivers; driv; driv = driv->next) { 73 for (driv = comedi_drivers; driv; driv = driv->next) {
75 l += sprintf(buf + l, "%s:\n", driv->driver_name); 74 l += sprintf(buf + l, "%s:\n", driv->driver_name);
@@ -78,9 +77,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
78 *(char **)((char *)driv->board_name + 77 *(char **)((char *)driv->board_name +
79 i * driv->offset)); 78 i * driv->offset));
80 } 79 }
81 if (!driv->num_names) { 80 if (!driv->num_names)
82 l += sprintf(buf + l, " %s\n", driv->driver_name); 81 l += sprintf(buf + l, " %s\n", driv->driver_name);
83 }
84 } 82 }
85 83
86 return l; 84 return l;
diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c
index b8eb4ec4185..e54be6182ee 100644
--- a/drivers/staging/comedi/range.c
+++ b/drivers/staging/comedi/range.c
@@ -135,9 +135,8 @@ int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist)
135 i, chanlist[i], s->n_chan, 135 i, chanlist[i], s->n_chan,
136 s->range_table->length); 136 s->range_table->length);
137#if 0 137#if 0
138 for (i = 0; i < n; i++) { 138 for (i = 0; i < n; i++)
139 printk("[%d]=0x%08x\n", i, chanlist[i]); 139 printk("[%d]=0x%08x\n", i, chanlist[i]);
140 }
141#endif 140#endif
142 return -EINVAL; 141 return -EINVAL;
143 } 142 }
diff --git a/drivers/staging/comedi/rt.c b/drivers/staging/comedi/rt.c
index f4b85125254..e6ec8b98a15 100644
--- a/drivers/staging/comedi/rt.c
+++ b/drivers/staging/comedi/rt.c
@@ -84,9 +84,9 @@ int comedi_request_irq(unsigned irq, irqreturn_t(*handler) (int,
84 ("comedi: cannot get unshared interrupt, will not use RT interrupts.\n"); 84 ("comedi: cannot get unshared interrupt, will not use RT interrupts.\n");
85 ret = request_irq(irq, handler, flags, device, dev_id); 85 ret = request_irq(irq, handler, flags, device, dev_id);
86 } 86 }
87 if (ret < 0) { 87 if (ret < 0)
88 return ret; 88 return ret;
89 } 89
90 } else { 90 } else {
91 it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL); 91 it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL);
92 if (!it) 92 if (!it)