aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAndrea Gelmini <andrea.gelmini@gelma.net>2010-02-26 11:37:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 19:43:07 -0500
commit5617f9da4619ec975514e6b385a052e024215da3 (patch)
tree01dac9b66afacfa6dd1e9a510a3809a5ef2518f0 /drivers/staging
parentb91665e95d1968c3cd8dd0c3a9a8d617639db1a6 (diff)
Staging: comedi: drivers.c: Checkpatch cleanup
WARNING: Use #include <linux/io.h> instead of <asm/io.h> +#include <asm/io.h> WARNING: braces {} are not necessary for any arm of this statement + if (dev->driver) { [...] + } else { [...] WARNING: braces {} are not necessary for single statement blocks + if (insn->insn == INSN_READ) { + data[0] = (new_data[1] >> (chan - base_bitfield_channel)) & 1; + } WARNING: braces {} are not necessary for single statement blocks + if (async->prealloc_buf && async->prealloc_bufsz == new_size) { + return 0; + } WARNING: braces {} are not necessary for single statement blocks + if (async->buf_page_list[i].virt_addr == NULL) { + break; + } WARNING: braces {} are not necessary for single statement blocks + if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0) { + nbytes = free_end - async->buf_write_alloc_count; + } WARNING: braces {} are not necessary for single statement blocks + if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0) { + nbytes = 0; + } WARNING: braces {} are not necessary for single statement blocks + if (async->buf_write_ptr >= async->prealloc_bufsz) { + async->buf_write_ptr %= async->prealloc_bufsz; + } Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index c2a632d31c61..44d6b62c230d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -44,7 +44,7 @@
44#include <linux/cdev.h> 44#include <linux/cdev.h>
45#include <linux/dma-mapping.h> 45#include <linux/dma-mapping.h>
46 46
47#include <asm/io.h> 47#include <linux/io.h>
48#include <asm/system.h> 48#include <asm/system.h>
49 49
50static int postconfig(struct comedi_device *dev); 50static int postconfig(struct comedi_device *dev);
@@ -99,11 +99,10 @@ static void cleanup_device(struct comedi_device *dev)
99static void __comedi_device_detach(struct comedi_device *dev) 99static void __comedi_device_detach(struct comedi_device *dev)
100{ 100{
101 dev->attached = 0; 101 dev->attached = 0;
102 if (dev->driver) { 102 if (dev->driver)
103 dev->driver->detach(dev); 103 dev->driver->detach(dev);
104 } else { 104 else
105 printk("BUG: dev->driver=NULL in comedi_device_detach()\n"); 105 printk("BUG: dev->driver=NULL in comedi_device_detach()\n");
106 }
107 cleanup_device(dev); 106 cleanup_device(dev);
108} 107}
109 108
@@ -380,9 +379,8 @@ static int insn_rw_emulate_bits(struct comedi_device *dev,
380 if (ret < 0) 379 if (ret < 0)
381 return ret; 380 return ret;
382 381
383 if (insn->insn == INSN_READ) { 382 if (insn->insn == INSN_READ)
384 data[0] = (new_data[1] >> (chan - base_bitfield_channel)) & 1; 383 data[0] = (new_data[1] >> (chan - base_bitfield_channel)) & 1;
385 }
386 384
387 return 1; 385 return 1;
388} 386}
@@ -429,9 +427,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
429 new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK; 427 new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK;
430 428
431 /* if no change is required, do nothing */ 429 /* if no change is required, do nothing */
432 if (async->prealloc_buf && async->prealloc_bufsz == new_size) { 430 if (async->prealloc_buf && async->prealloc_bufsz == new_size)
433 return 0; 431 return 0;
434 } 432
435 /* deallocate old buffer */ 433 /* deallocate old buffer */
436 if (async->prealloc_buf) { 434 if (async->prealloc_buf) {
437 vunmap(async->prealloc_buf); 435 vunmap(async->prealloc_buf);
@@ -494,9 +492,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
494 (void *) 492 (void *)
495 get_zeroed_page(GFP_KERNEL); 493 get_zeroed_page(GFP_KERNEL);
496 } 494 }
497 if (async->buf_page_list[i].virt_addr == NULL) { 495 if (async->buf_page_list[i].virt_addr == NULL)
498 break; 496 break;
499 } 497
500 mem_map_reserve(virt_to_page 498 mem_map_reserve(virt_to_page
501 (async->buf_page_list[i]. 499 (async->buf_page_list[i].
502 virt_addr)); 500 virt_addr));
@@ -619,9 +617,9 @@ unsigned int comedi_buf_write_alloc(struct comedi_async *async,
619{ 617{
620 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; 618 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
621 619
622 if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0) { 620 if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0)
623 nbytes = free_end - async->buf_write_alloc_count; 621 nbytes = free_end - async->buf_write_alloc_count;
624 } 622
625 async->buf_write_alloc_count += nbytes; 623 async->buf_write_alloc_count += nbytes;
626 /* barrier insures the read of buf_read_count above occurs before 624 /* barrier insures the read of buf_read_count above occurs before
627 we write data to the write-alloc'ed buffer space */ 625 we write data to the write-alloc'ed buffer space */
@@ -635,9 +633,9 @@ unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async,
635{ 633{
636 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; 634 unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
637 635
638 if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0) { 636 if ((int)(async->buf_write_alloc_count + nbytes - free_end) > 0)
639 nbytes = 0; 637 nbytes = 0;
640 } 638
641 async->buf_write_alloc_count += nbytes; 639 async->buf_write_alloc_count += nbytes;
642 /* barrier insures the read of buf_read_count above occurs before 640 /* barrier insures the read of buf_read_count above occurs before
643 we write data to the write-alloc'ed buffer space */ 641 we write data to the write-alloc'ed buffer space */
@@ -657,9 +655,9 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
657 async->buf_write_count += nbytes; 655 async->buf_write_count += nbytes;
658 async->buf_write_ptr += nbytes; 656 async->buf_write_ptr += nbytes;
659 comedi_buf_munge(async, async->buf_write_count - async->munge_count); 657 comedi_buf_munge(async, async->buf_write_count - async->munge_count);
660 if (async->buf_write_ptr >= async->prealloc_bufsz) { 658 if (async->buf_write_ptr >= async->prealloc_bufsz)
661 async->buf_write_ptr %= async->prealloc_bufsz; 659 async->buf_write_ptr %= async->prealloc_bufsz;
662 } 660
663 return nbytes; 661 return nbytes;
664} 662}
665 663