All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Staging: comedi: fix style errors in adl_pci9111.c
@ 2010-06-16 18:30 John Sheehan
  2010-06-16 19:28 ` Charles Clément
  0 siblings, 1 reply; 3+ messages in thread
From: John Sheehan @ 2010-06-16 18:30 UTC (permalink / raw)
  To: gregkh, wfp5p, rich.folsom, mithlesh, jirislaby, john.d.sheehan
  Cc: devel, linux-kernel

From: John Sheehan <john.d.sheehan@gmail.com>

a patch for adl_pci9111.c, to fix the following
errors reported by the checkpatch.pl tool,

-Macros with complex values should be enclosed in parenthesis
-need consistent spacing around '&' (ctx:WxV)
-spaces required around that '==' (ctx:VxV)
-Macros with complex values should be enclosed in parenthesis
-trailing statements should be on next line

Signed-off-by: John Sheehan <john.d.sheehan@gmail.com>
---
 drivers/staging/comedi/drivers/adl_pci9111.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index 36a254c..b9501ce 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -177,7 +177,7 @@ TODO:
 #define PCI9111_FIFO_FULL_MASK				0x40
 #define PCI9111_AD_BUSY_MASK				0x80
 
-#define PCI9111_IO_BASE dev->iobase
+#define PCI9111_IO_BASE (dev->iobase)
 
 /*
  * Define inlined function
@@ -190,7 +190,7 @@ TODO:
   outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_TRIGGER_MODE_CONTROL)
 
 #define pci9111_interrupt_and_fifo_get() \
-  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
+  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4)&0x03)
 
 #define pci9111_interrupt_and_fifo_set(flags) \
   outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL)
@@ -208,35 +208,35 @@ TODO:
 
 #define pci9111_is_fifo_full() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
-    PCI9111_FIFO_FULL_MASK)==0)
+    PCI9111_FIFO_FULL_MASK) == 0)
 
 #define pci9111_is_fifo_half_full() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
-    PCI9111_FIFO_HALF_FULL_MASK)==0)
+    PCI9111_FIFO_HALF_FULL_MASK) == 0)
 
 #define pci9111_is_fifo_empty() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
-    PCI9111_FIFO_EMPTY_MASK)==0)
+    PCI9111_FIFO_EMPTY_MASK) == 0)
 
 #define pci9111_ai_channel_set(channel) \
   outb((channel)&PCI9111_CHANNEL_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_CONTROL)
 
 #define pci9111_ai_channel_get() \
-  inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_READBACK)&PCI9111_CHANNEL_MASK
+  (inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_READBACK)&(PCI9111_CHANNEL_MASK))
 
 #define pci9111_ai_range_set(range) \
   outb((range)&PCI9111_RANGE_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_INPUT_SIGNAL_RANGE)
 
 #define pci9111_ai_range_get() \
-  inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)&PCI9111_RANGE_MASK
+  (inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)&(PCI9111_RANGE_MASK))
 
 #define pci9111_ai_get_data() \
-  ((inw(PCI9111_IO_BASE+PCI9111_REGISTER_AD_FIFO_VALUE)>>4)&PCI9111_AI_RESOLUTION_MASK) \
-  ^ PCI9111_AI_RESOLUTION_2_CMP_BIT
+  (((inw(PCI9111_IO_BASE+PCI9111_REGISTER_AD_FIFO_VALUE)>>4)&PCI9111_AI_RESOLUTION_MASK) \
+  ^ (PCI9111_AI_RESOLUTION_2_CMP_BIT))
 
 #define pci9111_hr_ai_get_data() \
-  (inw(PCI9111_IO_BASE+PCI9111_REGISTER_AD_FIFO_VALUE) & PCI9111_HR_AI_RESOLUTION_MASK) \
-  ^ PCI9111_HR_AI_RESOLUTION_2_CMP_BIT
+  ((inw(PCI9111_IO_BASE+PCI9111_REGISTER_AD_FIFO_VALUE) & PCI9111_HR_AI_RESOLUTION_MASK) \
+  ^ (PCI9111_HR_AI_RESOLUTION_2_CMP_BIT))
 
 #define pci9111_ao_set_data(data) \
   outw(data&PCI9111_AO_RESOLUTION_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_DA_OUTPUT)
@@ -551,7 +551,8 @@ static int pci9111_ai_cancel(struct comedi_device *dev,
 #define pci9111_check_trigger_src(src, flags) \
   tmp = src; \
   src &= flags; \
-  if (!src || tmp != src) error++
+  if (!src || tmp != src) \
+	error++
 
 static int
 pci9111_ai_do_cmd_test(struct comedi_device *dev,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Staging: comedi: fix style errors in adl_pci9111.c
  2010-06-16 18:30 [PATCH 1/2] Staging: comedi: fix style errors in adl_pci9111.c John Sheehan
@ 2010-06-16 19:28 ` Charles Clément
       [not found]   ` <AANLkTil0ezKl6SbtvGe0Vn_d6RX789NMAnwvRKheDUaK@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Clément @ 2010-06-16 19:28 UTC (permalink / raw)
  To: John Sheehan
  Cc: gregkh, wfp5p, rich.folsom, mithlesh, jirislaby, devel, linux-kernel

Hi,

On Wed, Jun 16, 2010 at 07:30:09PM +0100, John Sheehan wrote:
> From: John Sheehan <john.d.sheehan@gmail.com>

> @@ -190,7 +190,7 @@ TODO:
>    outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_TRIGGER_MODE_CONTROL)
>  
>  #define pci9111_interrupt_and_fifo_get() \
> -  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
> +  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4)&0x03)

Doesn't checkpatch.pl suggest to add a whitespace after the & in that case?
It would seem more readable.

-- 
Charles Clément


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Staging: comedi: fix style errors in adl_pci9111.c
       [not found]   ` <AANLkTil0ezKl6SbtvGe0Vn_d6RX789NMAnwvRKheDUaK@mail.gmail.com>
@ 2010-06-20 20:02     ` Charles Clément
  0 siblings, 0 replies; 3+ messages in thread
From: Charles Clément @ 2010-06-20 20:02 UTC (permalink / raw)
  To: John Sheehan
  Cc: Charles Clément, gregkh, wfp5p, rich.folsom, mithlesh,
	jirislaby, john.d.sheehan, devel, linux-kernel

On Thu, Jun 17, 2010 at 10:33:36AM +0100, John Sheehan wrote:
> Hi Charles,
> 
> 2010/6/16 Charles Clément <caratorn@gmail.com>:
> > Hi,
> >
> > On Wed, Jun 16, 2010 at 07:30:09PM +0100, John Sheehan wrote:
> >> From: John Sheehan <john.d.sheehan@gmail.com>
> >
> >> @@ -190,7 +190,7 @@ TODO:
> >>    outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_TRIGGER_MODE_CONTROL)
> >>
> >>  #define pci9111_interrupt_and_fifo_get() \
> >> -  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
> >> +  ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4)&0x03)
> >
> > Doesn't checkpatch.pl suggest to add a whitespace after the & in that case?
> 
> no, surprisingly enough, it just requires the amount of whitespace at
> either side of the & to be consistent

Any specific reason to take this off the list?

> 
> John
> > It would seem more readable.
> >
> > --
> > Charles Clément
> >
> >

-- 
Charles Clément


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-20 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 18:30 [PATCH 1/2] Staging: comedi: fix style errors in adl_pci9111.c John Sheehan
2010-06-16 19:28 ` Charles Clément
     [not found]   ` <AANLkTil0ezKl6SbtvGe0Vn_d6RX789NMAnwvRKheDUaK@mail.gmail.com>
2010-06-20 20:02     ` Charles Clément

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.