[PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply

2015-01-19 Thread Chase Southwood
Checkpatch doesn't like kmalloc with multiply very much:
drivers/staging/comedi/drivers/das1800.c:1377: WARNING: Prefer kmalloc_array 
over kmalloc with multiply

So this patch swaps that use out for kmalloc_array instead.

Signed-off-by: Chase Southwood 
---
 drivers/staging/comedi/drivers/das1800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 381ae94..13ed31c 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1374,7 +1374,7 @@ static int das1800_attach(struct comedi_device *dev,
if (dev->irq & it->options[2])
das1800_init_dma(dev, it);
 
-   devpriv->fifo_buf = kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL);
+   devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), 
GFP_KERNEL);
if (!devpriv->fifo_buf)
return -ENOMEM;
 
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply

2015-01-19 Thread Chase Southwood
Checkpatch doesn't like kmalloc with multiply very much:
drivers/staging/comedi/drivers/das1800.c:1377: WARNING: Prefer kmalloc_array 
over kmalloc with multiply

So this patch swaps that use out for kmalloc_array instead.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
---
 drivers/staging/comedi/drivers/das1800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 381ae94..13ed31c 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1374,7 +1374,7 @@ static int das1800_attach(struct comedi_device *dev,
if (dev-irq  it-options[2])
das1800_init_dma(dev, it);
 
-   devpriv-fifo_buf = kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL);
+   devpriv-fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), 
GFP_KERNEL);
if (!devpriv-fifo_buf)
return -ENOMEM;
 
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: change some printk calls to pr_err

2014-11-30 Thread Chase Southwood
There are a handful of calls to printk in ni_stc.h without specified log
levels, as well as one in ni_mio_common.c.  This patch converts these
calls to pr_err() instead, so that they are now explicitly log level
ERR.

Signed-off-by: Chase Southwood 
---
I tacked the change to ni_mio_common.c on to this patch since it's the same
exact change and it's just one line, so I think a single patch is justified
here.
 drivers/staging/comedi/drivers/ni_mio_common.c |  2 +-
 drivers/staging/comedi/drivers/ni_stc.h| 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 353c17b..11e7017 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3945,7 +3945,7 @@ static unsigned ni_gpct_to_stc_register(enum 
ni_gpct_register reg)
stc_register = Interrupt_B_Enable_Register;
break;
default:
-   printk("%s: unhandled register 0x%x in switch.\n",
+   pr_err("%s: unhandled register 0x%x in switch.\n",
   __func__, reg);
BUG();
return 0;
diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index 131e904..bd69c3f 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -334,7 +334,7 @@ static inline unsigned RTSI_Output_Bit(unsigned channel, 
int is_mseries)
max_channel = 6;
}
if (channel > max_channel) {
-   printk("%s: bug, invalid RTSI_channel=%i\n", __func__, channel);
+   pr_err("%s: bug, invalid RTSI_channel=%i\n", __func__, channel);
return 0;
}
return 1 << (base_bit_shift + channel);
@@ -1090,7 +1090,7 @@ static inline int M_Offset_Static_AI_Control(int i)
0x263,
};
if (((unsigned)i) >= ARRAY_SIZE(offset)) {
-   printk("%s: invalid channel=%i\n", __func__, i);
+   pr_err("%s: invalid channel=%i\n", __func__, i);
return offset[0];
}
return offset[i];
@@ -1105,7 +1105,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int 
channel)
0x267
};
if (((unsigned)channel) >= ARRAY_SIZE(offset)) {
-   printk("%s: invalid channel=%i\n", __func__, channel);
+   pr_err("%s: invalid channel=%i\n", __func__, channel);
return offset[0];
}
return offset[channel];
@@ -1114,7 +1114,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int 
channel)
 static inline unsigned M_Offset_PFI_Output_Select(unsigned n)
 {
if (n < 1 || n > NUM_PFI_OUTPUT_SELECT_REGS) {
-   printk("%s: invalid pfi output select register=%i\n",
+   pr_err("%s: invalid pfi output select register=%i\n",
   __func__, n);
return M_Offset_PFI_Output_Select_1;
}
@@ -1171,7 +1171,7 @@ static inline unsigned 
MSeries_PLL_In_Source_Select_RTSI_Bits(unsigned
  RTSI_channel)
 {
if (RTSI_channel > 7) {
-   printk("%s: bug, invalid RTSI_channel=%i\n", __func__,
+   pr_err("%s: bug, invalid RTSI_channel=%i\n", __func__,
   RTSI_channel);
return 0;
}
@@ -1192,7 +1192,7 @@ static inline unsigned MSeries_PLL_Divisor_Bits(unsigned 
divisor)
 {
static const unsigned max_divisor = 0x10;
if (divisor < 1 || divisor > max_divisor) {
-   printk("%s: bug, invalid divisor=%i\n", __func__, divisor);
+   pr_err("%s: bug, invalid divisor=%i\n", __func__, divisor);
return 0;
}
return (divisor & 0xf) << 8;
@@ -1202,7 +1202,7 @@ static inline unsigned 
MSeries_PLL_Multiplier_Bits(unsigned multiplier)
 {
static const unsigned max_multiplier = 0x100;
if (multiplier < 1 || multiplier > max_multiplier) {
-   printk("%s: bug, invalid multiplier=%i\n", __func__,
+   pr_err("%s: bug, invalid multiplier=%i\n", __func__,
   multiplier);
return 0;
}
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: change some printk calls to pr_err

2014-11-30 Thread Chase Southwood
There are a handful of calls to printk in ni_stc.h without specified log
levels, as well as one in ni_mio_common.c.  This patch converts these
calls to pr_err() instead, so that they are now explicitly log level
ERR.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
---
I tacked the change to ni_mio_common.c on to this patch since it's the same
exact change and it's just one line, so I think a single patch is justified
here.
 drivers/staging/comedi/drivers/ni_mio_common.c |  2 +-
 drivers/staging/comedi/drivers/ni_stc.h| 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 353c17b..11e7017 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3945,7 +3945,7 @@ static unsigned ni_gpct_to_stc_register(enum 
ni_gpct_register reg)
stc_register = Interrupt_B_Enable_Register;
break;
default:
-   printk(%s: unhandled register 0x%x in switch.\n,
+   pr_err(%s: unhandled register 0x%x in switch.\n,
   __func__, reg);
BUG();
return 0;
diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index 131e904..bd69c3f 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -334,7 +334,7 @@ static inline unsigned RTSI_Output_Bit(unsigned channel, 
int is_mseries)
max_channel = 6;
}
if (channel  max_channel) {
-   printk(%s: bug, invalid RTSI_channel=%i\n, __func__, channel);
+   pr_err(%s: bug, invalid RTSI_channel=%i\n, __func__, channel);
return 0;
}
return 1  (base_bit_shift + channel);
@@ -1090,7 +1090,7 @@ static inline int M_Offset_Static_AI_Control(int i)
0x263,
};
if (((unsigned)i) = ARRAY_SIZE(offset)) {
-   printk(%s: invalid channel=%i\n, __func__, i);
+   pr_err(%s: invalid channel=%i\n, __func__, i);
return offset[0];
}
return offset[i];
@@ -1105,7 +1105,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int 
channel)
0x267
};
if (((unsigned)channel) = ARRAY_SIZE(offset)) {
-   printk(%s: invalid channel=%i\n, __func__, channel);
+   pr_err(%s: invalid channel=%i\n, __func__, channel);
return offset[0];
}
return offset[channel];
@@ -1114,7 +1114,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int 
channel)
 static inline unsigned M_Offset_PFI_Output_Select(unsigned n)
 {
if (n  1 || n  NUM_PFI_OUTPUT_SELECT_REGS) {
-   printk(%s: invalid pfi output select register=%i\n,
+   pr_err(%s: invalid pfi output select register=%i\n,
   __func__, n);
return M_Offset_PFI_Output_Select_1;
}
@@ -1171,7 +1171,7 @@ static inline unsigned 
MSeries_PLL_In_Source_Select_RTSI_Bits(unsigned
  RTSI_channel)
 {
if (RTSI_channel  7) {
-   printk(%s: bug, invalid RTSI_channel=%i\n, __func__,
+   pr_err(%s: bug, invalid RTSI_channel=%i\n, __func__,
   RTSI_channel);
return 0;
}
@@ -1192,7 +1192,7 @@ static inline unsigned MSeries_PLL_Divisor_Bits(unsigned 
divisor)
 {
static const unsigned max_divisor = 0x10;
if (divisor  1 || divisor  max_divisor) {
-   printk(%s: bug, invalid divisor=%i\n, __func__, divisor);
+   pr_err(%s: bug, invalid divisor=%i\n, __func__, divisor);
return 0;
}
return (divisor  0xf)  8;
@@ -1202,7 +1202,7 @@ static inline unsigned 
MSeries_PLL_Multiplier_Bits(unsigned multiplier)
 {
static const unsigned max_multiplier = 0x100;
if (multiplier  1 || multiplier  max_multiplier) {
-   printk(%s: bug, invalid multiplier=%i\n, __func__,
+   pr_err(%s: bug, invalid multiplier=%i\n, __func__,
   multiplier);
return 0;
}
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] staging: comedi: hwdrv_apci3120: remove void function return statement

2014-09-10 Thread Chase Southwood
Returns at the end of void functions are useless.  Remove this one.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 470c866..2148ff4 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1598,8 +1598,6 @@ static void apci3120_interrupt(int irq, void *d)
}
 
}
-
-   return;
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: hwdrv_apci3120: else is not useful after return

2014-09-10 Thread Chase Southwood
The statement nested in an else after a return may be brought out one
indent level, the else is useless.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index d776a0c..470c866 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1217,8 +1217,8 @@ static int apci3120_ai_cmd(struct comedi_device *dev,
 
if (cmd->scan_begin_src == TRIG_FOLLOW)
return apci3120_cyclic_ai(1, dev, s);
-   else/* TRIG_TIMER */
-   return apci3120_cyclic_ai(2, dev, s);
+   /* TRIG_TIMER */
+   return apci3120_cyclic_ai(2, dev, s);
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] staging: comedi: hwdrv_apci3120: add a blank line after declarations

2014-09-10 Thread Chase Southwood
Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index bdb527f..d776a0c 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1008,6 +1008,7 @@ static int apci3120_cyclic_ai(int mode,
} else {
/* If DMA Enabled */
unsigned int scan_bytes = cmd->scan_end_arg * sizeof(short);
+
devpriv->b_InterruptMode = APCI3120_DMA_MODE;
 
/* Disables the EOC, EOS interrupt  */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] staging: comedi: hwdrv_apci1320: style cleanups

2014-09-10 Thread Chase Southwood
This patchset begins by cleaning up the mess of the comments in
this driver, then follows that with three very small and trivial
checkpatch warning fixes.

Chase Southwood (4):
  staging: comedi: hwdrv_apci3120: clean up comments
  staging: comedi: hwdrv_apci3120: add a blank line after declarations
  staging: comedi: hwdrv_apci3120: else is not useful after return
  staging: comedi: hwdrv_apci3120: remove void function return statement

 .../comedi/drivers/addi-data/hwdrv_apci3120.c  | 369 +++--
 1 file changed, 119 insertions(+), 250 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] staging: comedi: hwdrv_apci3120: clean up comments

2014-09-10 Thread Chase Southwood
This patch fixes improper comment indentation, removes dead code and
obsolete comments, and conforms remaining comments to a consistent kernel
commenting style.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci3120.c  | 364 +++--
 1 file changed, 117 insertions(+), 247 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 77cee87..bdb527f 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -241,13 +241,6 @@ static const struct comedi_lrange range_apci3120_ao = {
 
 
 /* FUNCTION DEFINITIONS */
-
-/*
-++
-|   ANALOG INPUT SUBDEVICE 
 |
-++
-*/
-
 static int apci3120_ai_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
@@ -260,7 +253,7 @@ static int apci3120_ai_insn_config(struct comedi_device 
*dev,
if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE))
return -1;
 
-   /*  Check for Conversion time to be added ?? */
+   /*  Check for Conversion time to be added */
devpriv->ui_EocEosConversionTime = data[2];
 
if (data[0] == APCI3120_EOS_MODE) {
@@ -282,7 +275,6 @@ static int apci3120_ai_insn_config(struct comedi_device 
*dev,
else
devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
/*  Copy channel list and Range List to devpriv */
-
devpriv->ui_AiNbrofChannels = data[3];
for (i = 0; i < devpriv->ui_AiNbrofChannels; i++)
devpriv->ui_AiChannelList[i] = data[4 + i];
@@ -311,7 +303,7 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
char check)
 {
struct addi_private *devpriv = dev->private;
-   unsigned int i; /* , differencial=0, bipolar=0; */
+   unsigned int i;
unsigned int gain;
unsigned short us_TmpValue;
 
@@ -326,7 +318,7 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
if (check)
return 1;
 
-   /* Code  to set the PA and PR...Here it set PA to 0.. */
+   /* Code  to set the PA and PR...Here it set PA to 0 */
devpriv->us_OutputRegister =
devpriv->us_OutputRegister & APCI3120_CLEAR_PA_PR;
devpriv->us_OutputRegister = ((n_chan - 1) & 0xf) << 8;
@@ -334,16 +326,16 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
 
for (i = 0; i < n_chan; i++) {
/*  store range list to card */
-   us_TmpValue = CR_CHAN(chanlist[i]); /*  get channel number; 
*/
+   us_TmpValue = CR_CHAN(chanlist[i]); /*  get channel number 
*/
 
if (CR_RANGE(chanlist[i]) < APCI3120_BIPOLAR_RANGES)
us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff);   /*  set 
bipolar */
else
-   us_TmpValue |= APCI3120_UNIPOLAR;   /*  enable 
unipolar.. */
+   us_TmpValue |= APCI3120_UNIPOLAR;   /*  enable 
unipolar */
 
gain = CR_RANGE(chanlist[i]);   /*  get gain number */
us_TmpValue |= ((gain & 0x03) << 4);/* <<4 for G0 and G1 
bit in RAM */
-   us_TmpValue |= i << 8;  /* To select the RAM LOCATION */
+   us_TmpValue |= i << 8;  /* To select the RAM LOCATION */
outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS);
}
return 1;   /*  we can serve this with scan logic */
@@ -370,24 +362,21 @@ static int apci3120_ai_insn_read(struct comedi_device 
*dev,
else
us_ConvertTiming = (unsigned short) 
(devpriv->ui_EocEosConversionTime / 1000);  /*  nano to useconds */
 
-   /*  
this_board->ai_read(dev,us_ConvertTiming,insn->n,>chanspec,data,insn->unused[0]);
 */
-
/*  Clear software registers */
devpriv->b_TimerSelectMode = 0;
devpriv->b_ModeSelectRegister = 0;
devpriv->us_OutputRegister = 0;
-/* devpriv->b_DigitalOutputRegister=0; */
 
if (insn->unused[0] == 222) {   /*  second insn read */
for (i = 0; i < insn->n; i++)
data[i] = devpriv->ui_AiReadData[i];
} else {
devpriv->tsk_Current = current; /*  Save the current process 
task structure */
-/*
- * Testing if board have the new Qu

[PATCH 1/4] staging: comedi: hwdrv_apci3120: clean up comments

2014-09-10 Thread Chase Southwood
This patch fixes improper comment indentation, removes dead code and
obsolete comments, and conforms remaining comments to a consistent kernel
commenting style.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci3120.c  | 364 +++--
 1 file changed, 117 insertions(+), 247 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 77cee87..bdb527f 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -241,13 +241,6 @@ static const struct comedi_lrange range_apci3120_ao = {
 
 
 /* FUNCTION DEFINITIONS */
-
-/*
-++
-|   ANALOG INPUT SUBDEVICE 
 |
-++
-*/
-
 static int apci3120_ai_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
@@ -260,7 +253,7 @@ static int apci3120_ai_insn_config(struct comedi_device 
*dev,
if ((data[0] != APCI3120_EOC_MODE)  (data[0] != APCI3120_EOS_MODE))
return -1;
 
-   /*  Check for Conversion time to be added ?? */
+   /*  Check for Conversion time to be added */
devpriv-ui_EocEosConversionTime = data[2];
 
if (data[0] == APCI3120_EOS_MODE) {
@@ -282,7 +275,6 @@ static int apci3120_ai_insn_config(struct comedi_device 
*dev,
else
devpriv-b_EocEosInterrupt = APCI3120_DISABLE;
/*  Copy channel list and Range List to devpriv */
-
devpriv-ui_AiNbrofChannels = data[3];
for (i = 0; i  devpriv-ui_AiNbrofChannels; i++)
devpriv-ui_AiChannelList[i] = data[4 + i];
@@ -311,7 +303,7 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
char check)
 {
struct addi_private *devpriv = dev-private;
-   unsigned int i; /* , differencial=0, bipolar=0; */
+   unsigned int i;
unsigned int gain;
unsigned short us_TmpValue;
 
@@ -326,7 +318,7 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
if (check)
return 1;
 
-   /* Code  to set the PA and PR...Here it set PA to 0.. */
+   /* Code  to set the PA and PR...Here it set PA to 0 */
devpriv-us_OutputRegister =
devpriv-us_OutputRegister  APCI3120_CLEAR_PA_PR;
devpriv-us_OutputRegister = ((n_chan - 1)  0xf)  8;
@@ -334,16 +326,16 @@ static int apci3120_setup_chan_list(struct comedi_device 
*dev,
 
for (i = 0; i  n_chan; i++) {
/*  store range list to card */
-   us_TmpValue = CR_CHAN(chanlist[i]); /*  get channel number; 
*/
+   us_TmpValue = CR_CHAN(chanlist[i]); /*  get channel number 
*/
 
if (CR_RANGE(chanlist[i])  APCI3120_BIPOLAR_RANGES)
us_TmpValue = ((~APCI3120_UNIPOLAR)  0xff);   /*  set 
bipolar */
else
-   us_TmpValue |= APCI3120_UNIPOLAR;   /*  enable 
unipolar.. */
+   us_TmpValue |= APCI3120_UNIPOLAR;   /*  enable 
unipolar */
 
gain = CR_RANGE(chanlist[i]);   /*  get gain number */
us_TmpValue |= ((gain  0x03)  4);/* 4 for G0 and G1 
bit in RAM */
-   us_TmpValue |= i  8;  /* To select the RAM LOCATION */
+   us_TmpValue |= i  8;  /* To select the RAM LOCATION */
outw(us_TmpValue, dev-iobase + APCI3120_SEQ_RAM_ADDRESS);
}
return 1;   /*  we can serve this with scan logic */
@@ -370,24 +362,21 @@ static int apci3120_ai_insn_read(struct comedi_device 
*dev,
else
us_ConvertTiming = (unsigned short) 
(devpriv-ui_EocEosConversionTime / 1000);  /*  nano to useconds */
 
-   /*  
this_board-ai_read(dev,us_ConvertTiming,insn-n,insn-chanspec,data,insn-unused[0]);
 */
-
/*  Clear software registers */
devpriv-b_TimerSelectMode = 0;
devpriv-b_ModeSelectRegister = 0;
devpriv-us_OutputRegister = 0;
-/* devpriv-b_DigitalOutputRegister=0; */
 
if (insn-unused[0] == 222) {   /*  second insn read */
for (i = 0; i  insn-n; i++)
data[i] = devpriv-ui_AiReadData[i];
} else {
devpriv-tsk_Current = current; /*  Save the current process 
task structure */
-/*
- * Testing if board have the new Quartz and calculate the time value
- * to set in the timer
- */
 
+   /*
+* Testing if board

[PATCH 0/4] staging: comedi: hwdrv_apci1320: style cleanups

2014-09-10 Thread Chase Southwood
This patchset begins by cleaning up the mess of the comments in
this driver, then follows that with three very small and trivial
checkpatch warning fixes.

Chase Southwood (4):
  staging: comedi: hwdrv_apci3120: clean up comments
  staging: comedi: hwdrv_apci3120: add a blank line after declarations
  staging: comedi: hwdrv_apci3120: else is not useful after return
  staging: comedi: hwdrv_apci3120: remove void function return statement

 .../comedi/drivers/addi-data/hwdrv_apci3120.c  | 369 +++--
 1 file changed, 119 insertions(+), 250 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] staging: comedi: hwdrv_apci3120: add a blank line after declarations

2014-09-10 Thread Chase Southwood
Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index bdb527f..d776a0c 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1008,6 +1008,7 @@ static int apci3120_cyclic_ai(int mode,
} else {
/* If DMA Enabled */
unsigned int scan_bytes = cmd-scan_end_arg * sizeof(short);
+
devpriv-b_InterruptMode = APCI3120_DMA_MODE;
 
/* Disables the EOC, EOS interrupt  */
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] staging: comedi: hwdrv_apci3120: remove void function return statement

2014-09-10 Thread Chase Southwood
Returns at the end of void functions are useless.  Remove this one.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 470c866..2148ff4 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1598,8 +1598,6 @@ static void apci3120_interrupt(int irq, void *d)
}
 
}
-
-   return;
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: hwdrv_apci3120: else is not useful after return

2014-09-10 Thread Chase Southwood
The statement nested in an else after a return may be brought out one
indent level, the else is useless.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index d776a0c..470c866 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1217,8 +1217,8 @@ static int apci3120_ai_cmd(struct comedi_device *dev,
 
if (cmd-scan_begin_src == TRIG_FOLLOW)
return apci3120_cyclic_ai(1, dev, s);
-   else/* TRIG_TIMER */
-   return apci3120_cyclic_ai(2, dev, s);
+   /* TRIG_TIMER */
+   return apci3120_cyclic_ai(2, dev, s);
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: hwdrv_apci1500: use dev->class_dev in calls to dev_warn()

2014-09-03 Thread Chase Southwood
git-grep reveals that hwdrv_apci1500.c is the only file in comedi that uses
dev->hw_dev in calls to dev_{err,warn}().  The rest of the drivers pass
dev->class_dev to these macros instead.  Switch the dev_warn() calls in
this driver to use dev->class_dev as well, for consistency.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
As an aside, it looks like lots of these cases are actually error
conditions that might be more appropriate use cases for dev_err().  But
they could be changed in a follow on patch, this is enough for this one.
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 104 ++---
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index e637be1..0ea081e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -176,7 +176,7 @@ static int apci1500_di_config(struct comedi_device *dev,
if (data[0] == 2) {
i_MaxChannel = 6;
} else {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"The specified port event does not exist\n");
return -EINVAL;
}
@@ -192,7 +192,7 @@ static int apci1500_di_config(struct comedi_device *dev,
data[1] = APCI1500_OR_PRIORITY;
break;
default:
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"The specified interrupt logic does not exist\n");
return -EINVAL;
}
@@ -237,7 +237,7 @@ static int apci1500_di_config(struct comedi_device *dev,
case 5:
break;
default:
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"The option indicated in the event mask does 
not exist\n");
return -EINVAL;
}
@@ -254,7 +254,7 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[1] == APCI1500_OR_PRIORITY
&& i_PatternTransition != 0) {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"Transition error on an OR PRIORITY 
logic\n");
return -EINVAL;
}
@@ -272,7 +272,7 @@ static int apci1500_di_config(struct comedi_device *dev,
}
 
if (i_PatternTransitionCount > 1) {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"Transition error on an AND 
logic\n");
return -EINVAL;
}
@@ -346,7 +346,7 @@ static int apci1500_di_config(struct comedi_device *dev,
APCI1500_Z8536_CONTROL_REGISTER);
 
} else {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"The choice for interrupt logic does not 
exist\n");
return -EINVAL;
}
@@ -446,7 +446,7 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
} else {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"The choice for interrupt logic does not 
exist\n");
return -EINVAL;
}
@@ -515,7 +515,7 @@ static int apci1500_di_write(struct comedi_device *dev,

APCI1500_Z8536_CONTROL_REGISTER);
 
} else {
-   dev_warn(dev->hw_dev,
+   dev_warn(dev->class_dev,
"Event 1 not initialised\n");
return -EINVAL;
}
@@ -551,13 +551,13 @@ static int apci1500_di_write(struct comedi_device *dev,

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 1;
} else {
-   dev_warn(d

[PATCH] staging: comedi: hwdrv_apci1500: use dev-class_dev in calls to dev_warn()

2014-09-03 Thread Chase Southwood
git-grep reveals that hwdrv_apci1500.c is the only file in comedi that uses
dev-hw_dev in calls to dev_{err,warn}().  The rest of the drivers pass
dev-class_dev to these macros instead.  Switch the dev_warn() calls in
this driver to use dev-class_dev as well, for consistency.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
As an aside, it looks like lots of these cases are actually error
conditions that might be more appropriate use cases for dev_err().  But
they could be changed in a follow on patch, this is enough for this one.
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 104 ++---
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index e637be1..0ea081e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -176,7 +176,7 @@ static int apci1500_di_config(struct comedi_device *dev,
if (data[0] == 2) {
i_MaxChannel = 6;
} else {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
The specified port event does not exist\n);
return -EINVAL;
}
@@ -192,7 +192,7 @@ static int apci1500_di_config(struct comedi_device *dev,
data[1] = APCI1500_OR_PRIORITY;
break;
default:
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
The specified interrupt logic does not exist\n);
return -EINVAL;
}
@@ -237,7 +237,7 @@ static int apci1500_di_config(struct comedi_device *dev,
case 5:
break;
default:
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
The option indicated in the event mask does 
not exist\n);
return -EINVAL;
}
@@ -254,7 +254,7 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[1] == APCI1500_OR_PRIORITY
 i_PatternTransition != 0) {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
Transition error on an OR PRIORITY 
logic\n);
return -EINVAL;
}
@@ -272,7 +272,7 @@ static int apci1500_di_config(struct comedi_device *dev,
}
 
if (i_PatternTransitionCount  1) {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
Transition error on an AND 
logic\n);
return -EINVAL;
}
@@ -346,7 +346,7 @@ static int apci1500_di_config(struct comedi_device *dev,
APCI1500_Z8536_CONTROL_REGISTER);
 
} else {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
The choice for interrupt logic does not 
exist\n);
return -EINVAL;
}
@@ -446,7 +446,7 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
} else {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
The choice for interrupt logic does not 
exist\n);
return -EINVAL;
}
@@ -515,7 +515,7 @@ static int apci1500_di_write(struct comedi_device *dev,

APCI1500_Z8536_CONTROL_REGISTER);
 
} else {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
Event 1 not initialised\n);
return -EINVAL;
}
@@ -551,13 +551,13 @@ static int apci1500_di_write(struct comedi_device *dev,

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 1;
} else {
-   dev_warn(dev-hw_dev,
+   dev_warn(dev-class_dev,
Event 2 not initialised\n

[PATCH 4/4] staging: comedi: hwdrv_apci1500: miscellaneous cleanup

2014-08-31 Thread Chase Southwood
This patch completes two final matters of cleanup which are each too small
for their own patch.  It corrects a couple of indentation issues and
removes a return statement at the end of a void function.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../staging/comedi/drivers/addi-data/hwdrv_apci1500.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index d98636b..e637be1 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -986,7 +986,7 @@ static int apci1500_timer_config(struct comedi_device *dev,
 
devpriv->tsk_Current = current;
 
-/* Selection of the input clock */
+   /* Selection of the input clock */
if (data[0] == 0 || data[0] == 1 || data[0] == 2) {
outw(data[0], devpriv->i_IobaseAddon + APCI1500_CLK_SELECT);
} else {
@@ -2180,7 +2180,6 @@ static void apci1500_interrupt(int irq, void *d)
"Interrupt from unknown source\n");
 
}
-   return;
 }
 
 static int apci1500_reset(struct comedi_device *dev)
@@ -2329,36 +2328,36 @@ static int apci1500_reset(struct comedi_device *dev)
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* reset all the digital outputs */
outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
-/* Disable the board interrupt */
+   /* Disable the board interrupt */
/* Selects the master interrupt control register */
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of port A */
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of port B */
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of timer 1 */
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of timer 2 */
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Selects the command and status register of timer 3*/
+   /* Selects the command and status register of timer 3*/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
return 0;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: hwdrv_apci1500: clean some whitespace style issues

2014-08-31 Thread Chase Southwood
Now that commented out code has been removed, else statements can move to
the same line as the close brace of the if statement.  Also, a blank line
has been added between declarations and code where needed.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 139 -
 1 file changed, 49 insertions(+), 90 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 031882e..d98636b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -172,12 +172,10 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[0] == 1) {
i_MaxChannel = 8;
-   }
-   else {
+   } else {
if (data[0] == 2) {
i_MaxChannel = 6;
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"The specified port event does not exist\n");
return -EINVAL;
@@ -347,8 +345,7 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"The choice for interrupt logic does not 
exist\n");
return -EINVAL;
@@ -448,8 +445,7 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0xF4,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"The choice for interrupt logic does not 
exist\n");
return -EINVAL;
@@ -518,8 +514,7 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
 
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"Event 1 not initialised\n");
return -EINVAL;
@@ -555,15 +550,13 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 1;
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"Event 2 not initialised\n");
return -EINVAL;
}
}
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"The port parameter is in error\n");
return -EINVAL;
@@ -600,8 +593,7 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event1InterruptStatus = 0;
-   }
-   else {
+   } else {
dev_warn(dev->hw_dev,
"Event 1 not initialised\n");
return -EINVAL;
@@ -630,16 +622,15 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 0;
-   }
-   else {
+   } else {
+
dev_warn(dev->hw_dev,
"Event 2 not initialised\n");
return -EINVAL;
}
}
 
-   }
-   else {
+ 

[PATCH 0/4] staging: comedi: hwdrv_apci1500: coding style cleanups

2014-08-31 Thread Chase Southwood
This patchset begins by removing unneeded braces and commented out lines
of code, and then tidies whitespace issues that are revealed after the
braces/dead code is removed.

Chase Southwood (4):
  staging: comedi: hwdrv_apci1500: remove unneeded braces
  staging: comedi: hwdrv_apci1500: remove commented out code
  staging: comedi: hwdrv_apci1500: clean some whitespace style issues
  staging: comedi: hwdrv_apci1500: miscellaneous cleanup

 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 349 +
 1 file changed, 149 insertions(+), 200 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] staging: comedi: hwdrv_apci1500: remove unneeded braces

2014-08-31 Thread Chase Southwood
We don't need braces around single-statement blocks.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 30 +-
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 1e2fe66..3cc827e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -835,10 +835,9 @@ static int apci1500_do_write(struct comedi_device *dev,
unsigned int ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);  /*  get the 
channel */
 
-   if (!devpriv->b_OutputMemoryStatus) {
+   if (!devpriv->b_OutputMemoryStatus)
ui_Temp = 0;
 
-   }   /* if(!devpriv->b_OutputMemoryStatus ) */
if (data[3] == 0) {
if (data[1] == 0) {
data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
@@ -1502,12 +1501,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
switch (data[1]) {
case START:
if (i_TimerCounter1Init == 1) {
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts timer/counter 1 */
i_TimerCounter1Enabled = 1;
/* Selects the commands and status register */
@@ -1578,12 +1576,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
switch (data[1]) {
case START:
if (i_TimerCounter2Init == 1) {
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts timer/counter 2 */
i_TimerCounter2Enabled = 1;
/* Selects the commands and status register */
@@ -1652,12 +1649,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
case START:
if (i_WatchdogCounter3Init == 1) {
 
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts Watchdog/counter 3 */
i_WatchdogCounter3Enabled = 1;
/* Selects the commands and status register */
@@ -2208,12 +2204,10 @@ static void apci1500_interrupt(int irq, void *d)
outb(i_RegValue,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   if (i_CounterLogic == APCI1500_COUNTER) {
+   if (i_CounterLogic == APCI1500_COUNTER)
i_InterruptMask = i_InterruptMask | 0x10;
-   }   /* if(i_CounterLogic==APCI1500_COUNTER) */
-   else {
+   else
i_InterruptMask = i_InterruptMask | 0x20;
-   }
}   /*  if ((i_RegValue & 0x60) == 0x60) */
 
send_sig(SIGIO, devpriv->tsk_Current, 0);   /*  send signal 
to the sample */
-- 
2.1.0

--
To unsubscribe from this list

[PATCH 2/4] staging: comedi: hwdrv_apci1500: remove commented out code

2014-08-31 Thread Chase Southwood
Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 249 ++---
 1 file changed, 123 insertions(+), 126 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 3cc827e..031882e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -172,17 +172,17 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[0] == 1) {
i_MaxChannel = 8;
-   }   /*  if (data[0] == 1) */
+   }
else {
if (data[0] == 2) {
i_MaxChannel = 6;
-   }   /*  if(data[0]==2) */
+   }
else {
dev_warn(dev->hw_dev,
"The specified port event does not exist\n");
return -EINVAL;
-   }   /* else if(data[0]==2) */
-   }   /* else  if (data[0] == 1) */
+   }
+   }
switch (data[1]) {
case 0:
data[1] = APCI1500_AND;
@@ -197,7 +197,7 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev->hw_dev,
"The specified interrupt logic does not exist\n");
return -EINVAL;
-   }   /* switch(data[1]); */
+   }
 
i_Logic = data[1];
for (i_Count = i_MaxChannel, i = 0; i_Count > 0; i_Count--, i++) {
@@ -242,8 +242,8 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev->hw_dev,
"The option indicated in the event mask does 
not exist\n");
return -EINVAL;
-   }   /*  switch(i_EventMask) */
-   }   /* for (i_Count = i_MaxChannel; i_Count 
>0;i_Count --) */
+   }
+   }
 
if (data[0] == 1) {
/* Test the interrupt logic */
@@ -259,7 +259,7 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev->hw_dev,
"Transition error on an OR PRIORITY 
logic\n");
return -EINVAL;
-   }   /*  if (data[1]== APCI1500_OR_PRIORITY && 
i_PatternTransition != 0) */
+   }
 
/* Tests if more than one transition */
/* was declared for an AND logic */
@@ -271,14 +271,14 @@ static int apci1500_di_config(struct comedi_device *dev,
((i_PatternTransition >>
i_Count) & 0x1);
 
-   }   /* for (i_Count = 0; i_Count < 8; 
i_Count++) */
+   }
 
if (i_PatternTransitionCount > 1) {
dev_warn(dev->hw_dev,
"Transition error on an AND 
logic\n");
return -EINVAL;
-   }   /*  if (i_PatternTransitionCount > 1) */
-   }   /*  if (data[1]== APCI1500_AND) */
+   }
+   }
 
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL 
register */
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
@@ -347,13 +347,13 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   }   /*  
if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) 
*/
+   }
else {
dev_warn(dev->hw_dev,
"The choice for interrupt logic does not 
exist\n");
return -EINVAL;
-   }   /*  else }// 
if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) 
*/
-   }   /*if (data[0]== 1) */
+   }
+   }
 
/* Test if event setting for port 2 */
 
@@ -448,13 +448,13 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0xF4,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   }   /*   if (data[1] == APCI1500_OR) */
+   }
else {
  

[PATCH] staging: comedi: hwdrv_apci3501: change printk to dev_err

2014-08-31 Thread Chase Southwood
dev_err() is preferred to printk() in device drivers.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
index e82c3fc..339519a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
@@ -168,7 +168,7 @@ static int apci3501_read_insn_timer(struct comedi_device 
*dev,
 
else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER)
&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) {
-   printk("\nIn ReadTimerCounterWatchdog :: Invalid Subdevice \n");
+   dev_err(dev->class_dev, "Invalid subdevice.\n");
}
return insn->n;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: hwdrv_apci035: remove useless return statement

2014-08-31 Thread Chase Southwood
Checkpatch pointed out a void function with a return statement.  It can be
removed.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
index cad33f1..53bb51b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
@@ -477,6 +477,4 @@ static void apci035_interrupt(int irq, void *d)
/*  send signal to the sample */
send_sig(SIGIO, devpriv->tsk_Current, 0);
}
-
-   return;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbdux: fix more sparse endianness warnings

2014-08-31 Thread Chase Southwood
Sparse shows a couple of warnings like:

drivers/staging/comedi/drivers/usbdux.c:889:20: warning: incorrect type in 
assignment (different base types)
drivers/staging/comedi/drivers/usbdux.c:889:20:expected unsigned short 
[unsigned] [short] [usertype] 
drivers/staging/comedi/drivers/usbdux.c:889:20:got restricted __le16 
[usertype] 

This is the result of a couple of calls to cpu_to_le16() being assigned to
uint16_t typed variables.  Switch the types of these variables/pointers to
__le16 accordingly.

Signed-off-by: Chase Southwood 
Suggested-by: Ian Abbott 
Cc: H Hartley Sweeten 
---

 drivers/staging/comedi/drivers/usbdux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 86c2c27..8eb2742 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -868,7 +868,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev,
struct usbdux_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int val = s->readback[chan];
-   uint16_t *p = (uint16_t *)>dux_commands[2];
+   __le16 *p = (__le16 *)>dux_commands[2];
int ret = -EBUSY;
int i;
 
@@ -1180,7 +1180,7 @@ static int usbdux_counter_write(struct comedi_device *dev,
 {
struct usbdux_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
-   uint16_t *p = (uint16_t *)>dux_commands[2];
+   __le16 *p = (__le16 *)>dux_commands[2];
int ret = 0;
int i;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbduxsigma: fix more sparse endianness warnings

2014-08-31 Thread Chase Southwood
Sparse shows a couple of warnings like:

drivers/staging/comedi/drivers/usbduxsigma.c:787:23: warning: cast to 
restricted __be32

Looking at the indicated lines shows that the issue is caused by an
incorrect cast to uint32_t instead of __be32.  Fix this cast.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 5dbab04..5bad118 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -784,7 +784,7 @@ static int usbduxsigma_ai_insn_read(struct comedi_device 
*dev,
}
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(get_unaligned((uint32_t
+   val = be32_to_cpu(get_unaligned((__be32
 *)(devpriv->insn_buf + 1)));
val &= 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
@@ -1343,7 +1343,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device 
*dev, int chan)
return ret;
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv->insn_buf + 1)));
+   val = be32_to_cpu(get_unaligned((__be32 *)(devpriv->insn_buf + 1)));
val &= 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: comedi: usbdux: fix sparse endianness warnings

2014-08-31 Thread Chase Southwood
On Sat, Aug 30, 2014 at 5:40 AM, Ian Abbott  wrote:
>
> That seems fine.  Perhaps the variable 'p' in usbdux_ao_insn_write() should
> also be of type '__le16 *'?
>

You're entirely correct.  I had seen this in the output from Sparse,
but for some reason at first glance I had convinced myself that the
fix would be more complicated than it is.  I'll get a patch out with a
Suggested-by: tag for you very soon.

Thanks,
Chase

> Reviewed-by: Ian Abbott 
>
> --
> -=( Ian Abbott @ MEV Ltd.E-mail: )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: comedi: usbdux: fix sparse endianness warnings

2014-08-31 Thread Chase Southwood
On Sat, Aug 30, 2014 at 5:40 AM, Ian Abbott abbo...@mev.co.uk wrote:

 That seems fine.  Perhaps the variable 'p' in usbdux_ao_insn_write() should
 also be of type '__le16 *'?


You're entirely correct.  I had seen this in the output from Sparse,
but for some reason at first glance I had convinced myself that the
fix would be more complicated than it is.  I'll get a patch out with a
Suggested-by: tag for you very soon.

Thanks,
Chase

 Reviewed-by: Ian Abbott abbo...@mev.co.uk

 --
 -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
 -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbdux: fix more sparse endianness warnings

2014-08-31 Thread Chase Southwood
Sparse shows a couple of warnings like:

drivers/staging/comedi/drivers/usbdux.c:889:20: warning: incorrect type in 
assignment (different base types)
drivers/staging/comedi/drivers/usbdux.c:889:20:expected unsigned short 
[unsigned] [short] [usertype] noident
drivers/staging/comedi/drivers/usbdux.c:889:20:got restricted __le16 
[usertype] noident

This is the result of a couple of calls to cpu_to_le16() being assigned to
uint16_t typed variables.  Switch the types of these variables/pointers to
__le16 accordingly.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Suggested-by: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---

 drivers/staging/comedi/drivers/usbdux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 86c2c27..8eb2742 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -868,7 +868,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev,
struct usbdux_private *devpriv = dev-private;
unsigned int chan = CR_CHAN(insn-chanspec);
unsigned int val = s-readback[chan];
-   uint16_t *p = (uint16_t *)devpriv-dux_commands[2];
+   __le16 *p = (__le16 *)devpriv-dux_commands[2];
int ret = -EBUSY;
int i;
 
@@ -1180,7 +1180,7 @@ static int usbdux_counter_write(struct comedi_device *dev,
 {
struct usbdux_private *devpriv = dev-private;
unsigned int chan = CR_CHAN(insn-chanspec);
-   uint16_t *p = (uint16_t *)devpriv-dux_commands[2];
+   __le16 *p = (__le16 *)devpriv-dux_commands[2];
int ret = 0;
int i;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbduxsigma: fix more sparse endianness warnings

2014-08-31 Thread Chase Southwood
Sparse shows a couple of warnings like:

drivers/staging/comedi/drivers/usbduxsigma.c:787:23: warning: cast to 
restricted __be32

Looking at the indicated lines shows that the issue is caused by an
incorrect cast to uint32_t instead of __be32.  Fix this cast.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 5dbab04..5bad118 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -784,7 +784,7 @@ static int usbduxsigma_ai_insn_read(struct comedi_device 
*dev,
}
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(get_unaligned((uint32_t
+   val = be32_to_cpu(get_unaligned((__be32
 *)(devpriv-insn_buf + 1)));
val = 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
@@ -1343,7 +1343,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device 
*dev, int chan)
return ret;
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv-insn_buf + 1)));
+   val = be32_to_cpu(get_unaligned((__be32 *)(devpriv-insn_buf + 1)));
val = 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: hwdrv_apci035: remove useless return statement

2014-08-31 Thread Chase Southwood
Checkpatch pointed out a void function with a return statement.  It can be
removed.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
index cad33f1..53bb51b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
@@ -477,6 +477,4 @@ static void apci035_interrupt(int irq, void *d)
/*  send signal to the sample */
send_sig(SIGIO, devpriv-tsk_Current, 0);
}
-
-   return;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: hwdrv_apci3501: change printk to dev_err

2014-08-31 Thread Chase Southwood
dev_err() is preferred to printk() in device drivers.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
index e82c3fc..339519a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
@@ -168,7 +168,7 @@ static int apci3501_read_insn_timer(struct comedi_device 
*dev,
 
else if ((devpriv-b_TimerSelectMode != ADDIDATA_TIMER)
 (devpriv-b_TimerSelectMode != ADDIDATA_WATCHDOG)) {
-   printk(\nIn ReadTimerCounterWatchdog :: Invalid Subdevice \n);
+   dev_err(dev-class_dev, Invalid subdevice.\n);
}
return insn-n;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] staging: comedi: hwdrv_apci1500: remove unneeded braces

2014-08-31 Thread Chase Southwood
We don't need braces around single-statement blocks.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 30 +-
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 1e2fe66..3cc827e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -835,10 +835,9 @@ static int apci1500_do_write(struct comedi_device *dev,
unsigned int ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn-chanspec);  /*  get the 
channel */
 
-   if (!devpriv-b_OutputMemoryStatus) {
+   if (!devpriv-b_OutputMemoryStatus)
ui_Temp = 0;
 
-   }   /* if(!devpriv-b_OutputMemoryStatus ) */
if (data[3] == 0) {
if (data[1] == 0) {
data[0] = (data[0]  ui_NoOfChannel) | ui_Temp;
@@ -1502,12 +1501,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
switch (data[1]) {
case START:
if (i_TimerCounter1Init == 1) {
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts timer/counter 1 */
i_TimerCounter1Enabled = 1;
/* Selects the commands and status register */
@@ -1578,12 +1576,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
switch (data[1]) {
case START:
if (i_TimerCounter2Init == 1) {
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts timer/counter 2 */
i_TimerCounter2Enabled = 1;
/* Selects the commands and status register */
@@ -1652,12 +1649,11 @@ static int apci1500_timer_write(struct comedi_device 
*dev,
case START:
if (i_WatchdogCounter3Init == 1) {
 
-   if (i_TimerCounterWatchdogInterrupt == 1) {
+   if (i_TimerCounterWatchdogInterrupt == 1)
i_CommandAndStatusValue = 0xC4; /* 
Enable the interrupt */
-   }   /*  
if(i_TimerCounterWatchdogInterrupt==1) */
-   else {
+   else
i_CommandAndStatusValue = 0xE4; /* 
disable the interrupt */
-   }   /* 
elseif(i_TimerCounterWatchdogInterrupt==1) */
+
/* Starts Watchdog/counter 3 */
i_WatchdogCounter3Enabled = 1;
/* Selects the commands and status register */
@@ -2208,12 +2204,10 @@ static void apci1500_interrupt(int irq, void *d)
outb(i_RegValue,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   if (i_CounterLogic == APCI1500_COUNTER) {
+   if (i_CounterLogic == APCI1500_COUNTER)
i_InterruptMask = i_InterruptMask | 0x10;
-   }   /* if(i_CounterLogic==APCI1500_COUNTER) */
-   else {
+   else
i_InterruptMask = i_InterruptMask | 0x20;
-   }
}   /*  if ((i_RegValue  0x60) == 0x60) */
 
send_sig(SIGIO, devpriv-tsk_Current, 0);   /*  send signal 
to the sample */
-- 
2.1.0

[PATCH 2/4] staging: comedi: hwdrv_apci1500: remove commented out code

2014-08-31 Thread Chase Southwood
Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 249 ++---
 1 file changed, 123 insertions(+), 126 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 3cc827e..031882e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -172,17 +172,17 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[0] == 1) {
i_MaxChannel = 8;
-   }   /*  if (data[0] == 1) */
+   }
else {
if (data[0] == 2) {
i_MaxChannel = 6;
-   }   /*  if(data[0]==2) */
+   }
else {
dev_warn(dev-hw_dev,
The specified port event does not exist\n);
return -EINVAL;
-   }   /* else if(data[0]==2) */
-   }   /* else  if (data[0] == 1) */
+   }
+   }
switch (data[1]) {
case 0:
data[1] = APCI1500_AND;
@@ -197,7 +197,7 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev-hw_dev,
The specified interrupt logic does not exist\n);
return -EINVAL;
-   }   /* switch(data[1]); */
+   }
 
i_Logic = data[1];
for (i_Count = i_MaxChannel, i = 0; i_Count  0; i_Count--, i++) {
@@ -242,8 +242,8 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev-hw_dev,
The option indicated in the event mask does 
not exist\n);
return -EINVAL;
-   }   /*  switch(i_EventMask) */
-   }   /* for (i_Count = i_MaxChannel; i_Count 
0;i_Count --) */
+   }
+   }
 
if (data[0] == 1) {
/* Test the interrupt logic */
@@ -259,7 +259,7 @@ static int apci1500_di_config(struct comedi_device *dev,
dev_warn(dev-hw_dev,
Transition error on an OR PRIORITY 
logic\n);
return -EINVAL;
-   }   /*  if (data[1]== APCI1500_OR_PRIORITY  
i_PatternTransition != 0) */
+   }
 
/* Tests if more than one transition */
/* was declared for an AND logic */
@@ -271,14 +271,14 @@ static int apci1500_di_config(struct comedi_device *dev,
((i_PatternTransition 
i_Count)  0x1);
 
-   }   /* for (i_Count = 0; i_Count  8; 
i_Count++) */
+   }
 
if (i_PatternTransitionCount  1) {
dev_warn(dev-hw_dev,
Transition error on an AND 
logic\n);
return -EINVAL;
-   }   /*  if (i_PatternTransitionCount  1) */
-   }   /*  if (data[1]== APCI1500_AND) */
+   }
+   }
 
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL 
register */
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
@@ -347,13 +347,13 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   }   /*  
if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) 
*/
+   }
else {
dev_warn(dev-hw_dev,
The choice for interrupt logic does not 
exist\n);
return -EINVAL;
-   }   /*  else }// 
if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) 
*/
-   }   /*if (data[0]== 1) */
+   }
+   }
 
/* Test if event setting for port 2 */
 
@@ -448,13 +448,13 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0xF4,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   }   /*   if (data[1] == APCI1500_OR) */
+   }
else {
dev_warn(dev-hw_dev,
The choice for interrupt

[PATCH 0/4] staging: comedi: hwdrv_apci1500: coding style cleanups

2014-08-31 Thread Chase Southwood
This patchset begins by removing unneeded braces and commented out lines
of code, and then tidies whitespace issues that are revealed after the
braces/dead code is removed.

Chase Southwood (4):
  staging: comedi: hwdrv_apci1500: remove unneeded braces
  staging: comedi: hwdrv_apci1500: remove commented out code
  staging: comedi: hwdrv_apci1500: clean some whitespace style issues
  staging: comedi: hwdrv_apci1500: miscellaneous cleanup

 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 349 +
 1 file changed, 149 insertions(+), 200 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] staging: comedi: hwdrv_apci1500: miscellaneous cleanup

2014-08-31 Thread Chase Southwood
This patch completes two final matters of cleanup which are each too small
for their own patch.  It corrects a couple of indentation issues and
removes a return statement at the end of a void function.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../staging/comedi/drivers/addi-data/hwdrv_apci1500.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index d98636b..e637be1 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -986,7 +986,7 @@ static int apci1500_timer_config(struct comedi_device *dev,
 
devpriv-tsk_Current = current;
 
-/* Selection of the input clock */
+   /* Selection of the input clock */
if (data[0] == 0 || data[0] == 1 || data[0] == 2) {
outw(data[0], devpriv-i_IobaseAddon + APCI1500_CLK_SELECT);
} else {
@@ -2180,7 +2180,6 @@ static void apci1500_interrupt(int irq, void *d)
Interrupt from unknown source\n);
 
}
-   return;
 }
 
 static int apci1500_reset(struct comedi_device *dev)
@@ -2329,36 +2328,36 @@ static int apci1500_reset(struct comedi_device *dev)
outb(0, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* reset all the digital outputs */
outw(0x0, devpriv-i_IobaseAddon + APCI1500_DIGITAL_OP);
-/* Disable the board interrupt */
+   /* Disable the board interrupt */
/* Selects the master interrupt control register */
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of port A */
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of port B */
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of timer 1 */
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the command and status register of timer 2 */
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Selects the command and status register of timer 3*/
+   /* Selects the command and status register of timer 3*/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
-/* Deactivates all interrupts */
+   /* Deactivates all interrupts */
outb(0x00, devpriv-iobase + APCI1500_Z8536_CONTROL_REGISTER);
return 0;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: hwdrv_apci1500: clean some whitespace style issues

2014-08-31 Thread Chase Southwood
Now that commented out code has been removed, else statements can move to
the same line as the close brace of the if statement.  Also, a blank line
has been added between declarations and code where needed.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 139 -
 1 file changed, 49 insertions(+), 90 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 031882e..d98636b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -172,12 +172,10 @@ static int apci1500_di_config(struct comedi_device *dev,
 
if (data[0] == 1) {
i_MaxChannel = 8;
-   }
-   else {
+   } else {
if (data[0] == 2) {
i_MaxChannel = 6;
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
The specified port event does not exist\n);
return -EINVAL;
@@ -347,8 +345,7 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
The choice for interrupt logic does not 
exist\n);
return -EINVAL;
@@ -448,8 +445,7 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0xF4,
devpriv-iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
The choice for interrupt logic does not 
exist\n);
return -EINVAL;
@@ -518,8 +514,7 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv-iobase +

APCI1500_Z8536_CONTROL_REGISTER);
 
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
Event 1 not initialised\n);
return -EINVAL;
@@ -555,15 +550,13 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv-iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 1;
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
Event 2 not initialised\n);
return -EINVAL;
}
}
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
The port parameter is in error\n);
return -EINVAL;
@@ -600,8 +593,7 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv-iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event1InterruptStatus = 0;
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
Event 1 not initialised\n);
return -EINVAL;
@@ -630,16 +622,15 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv-iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event2InterruptStatus = 0;
-   }
-   else {
+   } else {
+
dev_warn(dev-hw_dev,
Event 2 not initialised\n);
return -EINVAL;
}
}
 
-   }
-   else {
+   } else {
dev_warn(dev-hw_dev,
The port parameter

[PATCH] staging: comedi: addi_apci_1564: move boilerplate text to addi_apci_1564.c

2014-08-29 Thread Chase Southwood
Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 23 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 23 ++
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 198c627..d73db42 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -1,26 +1,3 @@
-/*
- * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
- *
- * ADDI-DATA GmbH
- * Dieselstrasse 3
- * D-77833 Ottersweier
- * Tel: +19(0)7223/9493-0
- * Fax: +49(0)7223/9493-92
- * http://www.addi-data.com
- * i...@addi-data.com
- *
- * This program is free software; you can redistribute it and/or modify it 
under
- * the terms of the GNU General Public License as published by the Free 
Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- */
-
 /* Digital Input IRQ Function Selection */
 #define APCI1564_DI_INT_OR (0 << 1)
 #define APCI1564_DI_INT_AND(1 << 1)
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16c02c8..6df3603 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -1,3 +1,26 @@
+/*
+ * addi_apci_1564.c
+ * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
+ *
+ * ADDI-DATA GmbH
+ * Dieselstrasse 3
+ * D-77833 Ottersweier
+ * Tel: +19(0)7223/9493-0
+ * Fax: +49(0)7223/9493-92
+ * http://www.addi-data.com
+ * i...@addi-data.com
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as published by the Free 
Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ */
+
 #include 
 #include 
 #include 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbdux: fix sparse endianness warnings

2014-08-29 Thread Chase Southwood
Sparse has many warnings like:

drivers/staging/comedi/drivers/usbdux.c:366:32: warning: cast to
restricted __le16

on lines on which devpriv->in_buf or devpriv->insn_buf are passed to
le16_to_cpu().  This suggests that both of these variables should actually
be of type __le16.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
This is, as usual, compile tested only.  I tried to verify as best as I
could that this is a sane change, but I am unable to test on the hardware.

 drivers/staging/comedi/drivers/usbdux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 053bc50..e1a19222 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -198,9 +198,9 @@ struct usbdux_private {
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   uint16_t *in_buf;
+   __le16 *in_buf;
/* input buffer for single insn */
-   uint16_t *insn_buf;
+   __le16 *insn_buf;
 
unsigned int ao_readback[USBDUX_NUM_AO_CHAN];
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbduxsigma: fix sparse endianness warnings

2014-08-29 Thread Chase Southwood
Sparse has many warnings like:

drivers/staging/comedi/drivers/usbduxsigma.c:293:21: warning: cast to
restricted __be32

on lines on which devpriv->in_buf is passed to be32_to_cpu().  This
suggests that this variable should actually be of type __be32.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
This is, as usual, compile tested only.  I tried to verify as best as I
could that this is a sane change, but I am unable to test on the hardware.

 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 94a09c1..e9b11e8 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -157,7 +157,7 @@ struct usbduxsigma_private {
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   uint32_t *in_buf;
+   __be32 *in_buf;
/* input buffer for single insn */
uint8_t *insn_buf;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbdux: fix sparse endianness warnings

2014-08-29 Thread Chase Southwood
Sparse has many warnings like:

drivers/staging/comedi/drivers/usbdux.c:366:32: warning: cast to
restricted __le16

on lines on which devpriv-in_buf or devpriv-insn_buf are passed to
le16_to_cpu().  This suggests that both of these variables should actually
be of type __le16.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
This is, as usual, compile tested only.  I tried to verify as best as I
could that this is a sane change, but I am unable to test on the hardware.

 drivers/staging/comedi/drivers/usbdux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 053bc50..e1a19222 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -198,9 +198,9 @@ struct usbdux_private {
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   uint16_t *in_buf;
+   __le16 *in_buf;
/* input buffer for single insn */
-   uint16_t *insn_buf;
+   __le16 *insn_buf;
 
unsigned int ao_readback[USBDUX_NUM_AO_CHAN];
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: usbduxsigma: fix sparse endianness warnings

2014-08-29 Thread Chase Southwood
Sparse has many warnings like:

drivers/staging/comedi/drivers/usbduxsigma.c:293:21: warning: cast to
restricted __be32

on lines on which devpriv-in_buf is passed to be32_to_cpu().  This
suggests that this variable should actually be of type __be32.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
This is, as usual, compile tested only.  I tried to verify as best as I
could that this is a sane change, but I am unable to test on the hardware.

 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 94a09c1..e9b11e8 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -157,7 +157,7 @@ struct usbduxsigma_private {
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   uint32_t *in_buf;
+   __be32 *in_buf;
/* input buffer for single insn */
uint8_t *insn_buf;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: addi_apci_1564: move boilerplate text to addi_apci_1564.c

2014-08-29 Thread Chase Southwood
Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 23 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 23 ++
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 198c627..d73db42 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -1,26 +1,3 @@
-/*
- * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
- *
- * ADDI-DATA GmbH
- * Dieselstrasse 3
- * D-77833 Ottersweier
- * Tel: +19(0)7223/9493-0
- * Fax: +49(0)7223/9493-92
- * http://www.addi-data.com
- * i...@addi-data.com
- *
- * This program is free software; you can redistribute it and/or modify it 
under
- * the terms of the GNU General Public License as published by the Free 
Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- */
-
 /* Digital Input IRQ Function Selection */
 #define APCI1564_DI_INT_OR (0  1)
 #define APCI1564_DI_INT_AND(1  1)
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16c02c8..6df3603 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -1,3 +1,26 @@
+/*
+ * addi_apci_1564.c
+ * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
+ *
+ * ADDI-DATA GmbH
+ * Dieselstrasse 3
+ * D-77833 Ottersweier
+ * Tel: +19(0)7223/9493-0
+ * Fax: +49(0)7223/9493-92
+ * http://www.addi-data.com
+ * i...@addi-data.com
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as published by the Free 
Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ */
+
 #include linux/module.h
 #include linux/pci.h
 #include linux/interrupt.h
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: s626: remove unnecessary variable initialization

2014-08-17 Thread Chase Southwood
We initialize 'irqbit' to 0, only to properly set it immediately
afterwards.  Just remove the zero-initialization.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/s626.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 080608a..e42720c 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1399,7 +1399,6 @@ static void s626_check_dio_interrupts(struct 
comedi_device *dev)
uint8_t group;
 
for (group = 0; group < S626_DIO_BANKS; group++) {
-   irqbit = 0;
/* read interrupt type */
irqbit = s626_debi_read(dev, S626_LP_RDCAPFLG(group));
 
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: dt2801: change function return type to void

2014-08-17 Thread Chase Southwood
cppcheck was complaining that the variable 'stat' is being reassigned
before the old value is used.  Upon inspection, I found that
dt2801_writecmd() cannot fail, always returns 0, and most callers already
do not bother with assigning its return value anyway, so it makes sense to
just change the return type for this function from int to void, and remove
the two assignments to 'stat'.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/dt2801.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2801.c 
b/drivers/staging/comedi/drivers/dt2801.c
index ad8ba0b..c16d468 100644
--- a/drivers/staging/comedi/drivers/dt2801.c
+++ b/drivers/staging/comedi/drivers/dt2801.c
@@ -309,7 +309,7 @@ static int dt2801_wait_for_ready(struct comedi_device *dev)
return -ETIME;
 }
 
-static int dt2801_writecmd(struct comedi_device *dev, int command)
+static void dt2801_writecmd(struct comedi_device *dev, int command)
 {
int stat;
 
@@ -323,8 +323,6 @@ static int dt2801_writecmd(struct comedi_device *dev, int 
command)
if (!(stat & DT_S_READY))
dev_dbg(dev->class_dev, "!ready in %s, ignoring\n", __func__);
outb_p(command, dev->iobase + DT2801_CMD);
-
-   return 0;
 }
 
 static int dt2801_reset(struct comedi_device *dev)
@@ -380,7 +378,7 @@ static int probe_number_of_ai_chans(struct comedi_device 
*dev)
int data;
 
for (n_chans = 0; n_chans < 16; n_chans++) {
-   stat = dt2801_writecmd(dev, DT_C_READ_ADIM);
+   dt2801_writecmd(dev, DT_C_READ_ADIM);
dt2801_writedata(dev, 0);
dt2801_writedata(dev, n_chans);
stat = dt2801_readdata2(dev, );
@@ -451,7 +449,7 @@ static int dt2801_ai_insn_read(struct comedi_device *dev,
int i;
 
for (i = 0; i < insn->n; i++) {
-   stat = dt2801_writecmd(dev, DT_C_READ_ADIM);
+   dt2801_writecmd(dev, DT_C_READ_ADIM);
dt2801_writedata(dev, CR_RANGE(insn->chanspec));
dt2801_writedata(dev, CR_CHAN(insn->chanspec));
stat = dt2801_readdata2(dev, );
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: dt2801: change function return type to void

2014-08-17 Thread Chase Southwood
cppcheck was complaining that the variable 'stat' is being reassigned
before the old value is used.  Upon inspection, I found that
dt2801_writecmd() cannot fail, always returns 0, and most callers already
do not bother with assigning its return value anyway, so it makes sense to
just change the return type for this function from int to void, and remove
the two assignments to 'stat'.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/dt2801.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2801.c 
b/drivers/staging/comedi/drivers/dt2801.c
index ad8ba0b..c16d468 100644
--- a/drivers/staging/comedi/drivers/dt2801.c
+++ b/drivers/staging/comedi/drivers/dt2801.c
@@ -309,7 +309,7 @@ static int dt2801_wait_for_ready(struct comedi_device *dev)
return -ETIME;
 }
 
-static int dt2801_writecmd(struct comedi_device *dev, int command)
+static void dt2801_writecmd(struct comedi_device *dev, int command)
 {
int stat;
 
@@ -323,8 +323,6 @@ static int dt2801_writecmd(struct comedi_device *dev, int 
command)
if (!(stat  DT_S_READY))
dev_dbg(dev-class_dev, !ready in %s, ignoring\n, __func__);
outb_p(command, dev-iobase + DT2801_CMD);
-
-   return 0;
 }
 
 static int dt2801_reset(struct comedi_device *dev)
@@ -380,7 +378,7 @@ static int probe_number_of_ai_chans(struct comedi_device 
*dev)
int data;
 
for (n_chans = 0; n_chans  16; n_chans++) {
-   stat = dt2801_writecmd(dev, DT_C_READ_ADIM);
+   dt2801_writecmd(dev, DT_C_READ_ADIM);
dt2801_writedata(dev, 0);
dt2801_writedata(dev, n_chans);
stat = dt2801_readdata2(dev, data);
@@ -451,7 +449,7 @@ static int dt2801_ai_insn_read(struct comedi_device *dev,
int i;
 
for (i = 0; i  insn-n; i++) {
-   stat = dt2801_writecmd(dev, DT_C_READ_ADIM);
+   dt2801_writecmd(dev, DT_C_READ_ADIM);
dt2801_writedata(dev, CR_RANGE(insn-chanspec));
dt2801_writedata(dev, CR_CHAN(insn-chanspec));
stat = dt2801_readdata2(dev, d);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: s626: remove unnecessary variable initialization

2014-08-17 Thread Chase Southwood
We initialize 'irqbit' to 0, only to properly set it immediately
afterwards.  Just remove the zero-initialization.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/s626.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 080608a..e42720c 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1399,7 +1399,6 @@ static void s626_check_dio_interrupts(struct 
comedi_device *dev)
uint8_t group;
 
for (group = 0; group  S626_DIO_BANKS; group++) {
-   irqbit = 0;
/* read interrupt type */
irqbit = s626_debi_read(dev, S626_LP_RDCAPFLG(group));
 
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: comedi: dt3000: remove unneeded variable

2014-08-16 Thread Chase Southwood
Coccinelle (using scripts/coccinelle/tests/doublebitand.cocci) found this
assignment because 0 is or'd twice.  Upon inspection, I found that the
variable "mode" is only assigned once and used once, and thus can be
cleanly removed.  This patch plugs its value straight into writew() and
then removes the variable.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
It occurred to me while doing this that zero might be or'd twice to
indicate "no information" in order to maintain some three-part structure
used elsewhere.  If this is the case, I think that the variable could
still be removed and the "| 0 | 0" could be added to the writew().

 drivers/staging/comedi/drivers/dt3000.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 56e21cc..176a7ee 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -488,7 +488,6 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
unsigned int chan, range, aref;
unsigned int divider;
unsigned int tscandiv;
-   unsigned int mode;
 
for (i = 0; i < cmd->chanlist_len; i++) {
chan = CR_CHAN(cmd->chanlist[i]);
@@ -513,8 +512,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
writew((tscandiv & 0x), dev->mmio + DPR_Params(4));
}
 
-   mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0;
-   writew(mode, dev->mmio + DPR_Params(5));
+   writew(DT3000_AD_RETRIG_INTERNAL, dev->mmio + DPR_Params(5));
writew(aref == AREF_DIFF, dev->mmio + DPR_Params(6));
 
writew(AI_FIFO_DEPTH / 2, dev->mmio + DPR_Params(7));
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] staging: comedi: addi_apci_1564: correct typo in macro definition

2014-08-16 Thread Chase Southwood
A recent commit introduced a typo in the definition of
APCI1564_DO_CC_INT_DISABLE.  The macro is not use yet, so not a huge deal,
but this patch corrects it.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 198c627..59f092d 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -33,7 +33,7 @@
 #define APCI1564_DO_VCC_INT_ENABLE 0x1
 #define APCI1564_DO_VCC_INT_DISABLE0xfffe
 #define APCI1564_DO_CC_INT_ENABLE  0x2
-#define APCI1564_DO_CC_IN_DISABLE  0xfffd
+#define APCI1564_DO_CC_INT_DISABLE 0xfffd
 
 /* TIMER COUNTER WATCHDOG DEFINES */
 #define ADDIDATA_TIMER 0
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: comedi: addi_apci_1564: add whitespace to subdevice init

2014-08-16 Thread Chase Southwood
For purely aesthetic purposes, add some whitespace to subdevice initialization.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 78 -
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16c02c8..ce82645 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -377,52 +377,52 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/*  Allocate and Initialise DI Subdevice Structures */
s = >subdevices[0];
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 32;
-   s->maxdata = 1;
-   s->range_table = _digital;
-   s->insn_bits = apci1564_di_insn_bits;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 32;
+   s->maxdata  = 1;
+   s->range_table  = _digital;
+   s->insn_bits= apci1564_di_insn_bits;
 
/*  Allocate and Initialise DO Subdevice Structures */
s = >subdevices[1];
-   s->type = COMEDI_SUBD_DO;
-   s->subdev_flags = SDF_WRITEABLE;
-   s->n_chan = 32;
-   s->maxdata = 1;
-   s->range_table = _digital;
-   s->insn_bits = apci1564_do_insn_bits;
+   s->type = COMEDI_SUBD_DO;
+   s->subdev_flags = SDF_WRITEABLE;
+   s->n_chan   = 32;
+   s->maxdata  = 1;
+   s->range_table  = _digital;
+   s->insn_bits= apci1564_do_insn_bits;
 
/* Change-Of-State (COS) interrupt subdevice */
s = >subdevices[2];
if (dev->irq) {
dev->read_subdev = s;
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
-   s->n_chan = 1;
-   s->maxdata = 1;
-   s->range_table = _digital;
-   s->len_chanlist = 1;
-   s->insn_config = apci1564_cos_insn_config;
-   s->insn_bits = apci1564_cos_insn_bits;
-   s->do_cmdtest = apci1564_cos_cmdtest;
-   s->do_cmd = apci1564_cos_cmd;
-   s->cancel = apci1564_cos_cancel;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
+   s->n_chan   = 1;
+   s->maxdata  = 1;
+   s->range_table  = _digital;
+   s->len_chanlist = 1;
+   s->insn_config  = apci1564_cos_insn_config;
+   s->insn_bits= apci1564_cos_insn_bits;
+   s->do_cmdtest   = apci1564_cos_cmdtest;
+   s->do_cmd   = apci1564_cos_cmd;
+   s->cancel   = apci1564_cos_cancel;
} else {
-   s->type = COMEDI_SUBD_UNUSED;
+   s->type = COMEDI_SUBD_UNUSED;
}
 
/*  Allocate and Initialise Timer Subdevice Structures */
s = >subdevices[3];
-   s->type = COMEDI_SUBD_TIMER;
-   s->subdev_flags = SDF_WRITEABLE;
-   s->n_chan = 1;
-   s->maxdata = 0;
-   s->len_chanlist = 1;
-   s->range_table = _digital;
-   s->insn_write = apci1564_timer_write;
-   s->insn_read = apci1564_timer_read;
-   s->insn_config = apci1564_timer_config;
+   s->type = COMEDI_SUBD_TIMER;
+   s->subdev_flags = SDF_WRITEABLE;
+   s->n_chan   = 1;
+   s->maxdata  = 0;
+   s->len_chanlist = 1;
+   s->range_table  = _digital;
+   s->insn_write   = apci1564_timer_write;
+   s->insn_read= apci1564_timer_read;
+   s->insn_config  = apci1564_timer_config;
 
/* Initialize the watchdog subdevice */
s = >subdevices[4];
@@ -432,12 +432,12 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/* Initialize the diagnostic status subdevice */
s = >subdevices[5];
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 2;
-   s->maxdata = 1;
-   s->range_table = _digital;
-   s->insn_bits = apci1564_diag_insn_bits;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 2;
+   s->maxdata  = 1;
+   s->range_table  = _digital;
+   s->insn_bits= apci1564_diag_insn_bits;
 
return 0;
 }
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: comedi: addi_apci_1564: add whitespace to subdevice init

2014-08-16 Thread Chase Southwood
For purely aesthetic purposes, add some whitespace to subdevice initialization.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 78 -
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16c02c8..ce82645 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -377,52 +377,52 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/*  Allocate and Initialise DI Subdevice Structures */
s = dev-subdevices[0];
-   s-type = COMEDI_SUBD_DI;
-   s-subdev_flags = SDF_READABLE;
-   s-n_chan = 32;
-   s-maxdata = 1;
-   s-range_table = range_digital;
-   s-insn_bits = apci1564_di_insn_bits;
+   s-type = COMEDI_SUBD_DI;
+   s-subdev_flags = SDF_READABLE;
+   s-n_chan   = 32;
+   s-maxdata  = 1;
+   s-range_table  = range_digital;
+   s-insn_bits= apci1564_di_insn_bits;
 
/*  Allocate and Initialise DO Subdevice Structures */
s = dev-subdevices[1];
-   s-type = COMEDI_SUBD_DO;
-   s-subdev_flags = SDF_WRITEABLE;
-   s-n_chan = 32;
-   s-maxdata = 1;
-   s-range_table = range_digital;
-   s-insn_bits = apci1564_do_insn_bits;
+   s-type = COMEDI_SUBD_DO;
+   s-subdev_flags = SDF_WRITEABLE;
+   s-n_chan   = 32;
+   s-maxdata  = 1;
+   s-range_table  = range_digital;
+   s-insn_bits= apci1564_do_insn_bits;
 
/* Change-Of-State (COS) interrupt subdevice */
s = dev-subdevices[2];
if (dev-irq) {
dev-read_subdev = s;
-   s-type = COMEDI_SUBD_DI;
-   s-subdev_flags = SDF_READABLE | SDF_CMD_READ;
-   s-n_chan = 1;
-   s-maxdata = 1;
-   s-range_table = range_digital;
-   s-len_chanlist = 1;
-   s-insn_config = apci1564_cos_insn_config;
-   s-insn_bits = apci1564_cos_insn_bits;
-   s-do_cmdtest = apci1564_cos_cmdtest;
-   s-do_cmd = apci1564_cos_cmd;
-   s-cancel = apci1564_cos_cancel;
+   s-type = COMEDI_SUBD_DI;
+   s-subdev_flags = SDF_READABLE | SDF_CMD_READ;
+   s-n_chan   = 1;
+   s-maxdata  = 1;
+   s-range_table  = range_digital;
+   s-len_chanlist = 1;
+   s-insn_config  = apci1564_cos_insn_config;
+   s-insn_bits= apci1564_cos_insn_bits;
+   s-do_cmdtest   = apci1564_cos_cmdtest;
+   s-do_cmd   = apci1564_cos_cmd;
+   s-cancel   = apci1564_cos_cancel;
} else {
-   s-type = COMEDI_SUBD_UNUSED;
+   s-type = COMEDI_SUBD_UNUSED;
}
 
/*  Allocate and Initialise Timer Subdevice Structures */
s = dev-subdevices[3];
-   s-type = COMEDI_SUBD_TIMER;
-   s-subdev_flags = SDF_WRITEABLE;
-   s-n_chan = 1;
-   s-maxdata = 0;
-   s-len_chanlist = 1;
-   s-range_table = range_digital;
-   s-insn_write = apci1564_timer_write;
-   s-insn_read = apci1564_timer_read;
-   s-insn_config = apci1564_timer_config;
+   s-type = COMEDI_SUBD_TIMER;
+   s-subdev_flags = SDF_WRITEABLE;
+   s-n_chan   = 1;
+   s-maxdata  = 0;
+   s-len_chanlist = 1;
+   s-range_table  = range_digital;
+   s-insn_write   = apci1564_timer_write;
+   s-insn_read= apci1564_timer_read;
+   s-insn_config  = apci1564_timer_config;
 
/* Initialize the watchdog subdevice */
s = dev-subdevices[4];
@@ -432,12 +432,12 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/* Initialize the diagnostic status subdevice */
s = dev-subdevices[5];
-   s-type = COMEDI_SUBD_DI;
-   s-subdev_flags = SDF_READABLE;
-   s-n_chan = 2;
-   s-maxdata = 1;
-   s-range_table = range_digital;
-   s-insn_bits = apci1564_diag_insn_bits;
+   s-type = COMEDI_SUBD_DI;
+   s-subdev_flags = SDF_READABLE;
+   s-n_chan   = 2;
+   s-maxdata  = 1;
+   s-range_table  = range_digital;
+   s-insn_bits= apci1564_diag_insn_bits;
 
return 0;
 }
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] staging: comedi: addi_apci_1564: correct typo in macro definition

2014-08-16 Thread Chase Southwood
A recent commit introduced a typo in the definition of
APCI1564_DO_CC_INT_DISABLE.  The macro is not use yet, so not a huge deal,
but this patch corrects it.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 198c627..59f092d 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -33,7 +33,7 @@
 #define APCI1564_DO_VCC_INT_ENABLE 0x1
 #define APCI1564_DO_VCC_INT_DISABLE0xfffe
 #define APCI1564_DO_CC_INT_ENABLE  0x2
-#define APCI1564_DO_CC_IN_DISABLE  0xfffd
+#define APCI1564_DO_CC_INT_DISABLE 0xfffd
 
 /* TIMER COUNTER WATCHDOG DEFINES */
 #define ADDIDATA_TIMER 0
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: comedi: dt3000: remove unneeded variable

2014-08-16 Thread Chase Southwood
Coccinelle (using scripts/coccinelle/tests/doublebitand.cocci) found this
assignment because 0 is or'd twice.  Upon inspection, I found that the
variable mode is only assigned once and used once, and thus can be
cleanly removed.  This patch plugs its value straight into writew() and
then removes the variable.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
It occurred to me while doing this that zero might be or'd twice to
indicate no information in order to maintain some three-part structure
used elsewhere.  If this is the case, I think that the variable could
still be removed and the | 0 | 0 could be added to the writew().

 drivers/staging/comedi/drivers/dt3000.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 56e21cc..176a7ee 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -488,7 +488,6 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
unsigned int chan, range, aref;
unsigned int divider;
unsigned int tscandiv;
-   unsigned int mode;
 
for (i = 0; i  cmd-chanlist_len; i++) {
chan = CR_CHAN(cmd-chanlist[i]);
@@ -513,8 +512,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
writew((tscandiv  0x), dev-mmio + DPR_Params(4));
}
 
-   mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0;
-   writew(mode, dev-mmio + DPR_Params(5));
+   writew(DT3000_AD_RETRIG_INTERNAL, dev-mmio + DPR_Params(5));
writew(aref == AREF_DIFF, dev-mmio + DPR_Params(6));
 
writew(AI_FIFO_DEPTH / 2, dev-mmio + DPR_Params(7));
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: comedi: addi_apci_1564: tidy register map defines

2014-08-11 Thread Chase Southwood
This commit performs a final tidying of the register map defines, bringing
them to a state that is ready for merging into addi_apci_1564.c when the
time comes.  Actions performed include:

*Removes the APCI1564_ADDRESS_RANGE macro, which is no longer needed/used.
*Renames the APCI1564_DIGITAL_OP_{VCC,CC}_INTERRUPT_{ENABLE,DISABLE}
macros to shorter names which are more consistent with the digital input
interrupt macros.
*Fixes a typo in a comment (dev>iobase changed to dev->iobase).
*Renames the APCI1564_TCW_* macros to APCI1564_COUNTER_* names to more
accurately reflect that they are only offsets to counter registers (since
only the counters are offset from dev->iobase).

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 70 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 19 +++---
 2 files changed, 48 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index f8d8cc9..198c627 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -21,8 +21,6 @@
  *
  */
 
-#define APCI1564_ADDRESS_RANGE 128
-
 /* Digital Input IRQ Function Selection */
 #define APCI1564_DI_INT_OR (0 << 1)
 #define APCI1564_DI_INT_AND(1 << 1)
@@ -32,10 +30,10 @@
 #define APCI1564_DI_INT_DISABLE0xfffb
 
 /* Digital Output Interrupt Enable Disable. */
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xfffe
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE0x2
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xfffd
+#define APCI1564_DO_VCC_INT_ENABLE 0x1
+#define APCI1564_DO_VCC_INT_DISABLE0xfffe
+#define APCI1564_DO_CC_INT_ENABLE  0x2
+#define APCI1564_DO_CC_IN_DISABLE  0xfffd
 
 /* TIMER COUNTER WATCHDOG DEFINES */
 #define ADDIDATA_TIMER 0
@@ -76,16 +74,16 @@
 #define APCI1564_TIMER_WARN_TIMEBASE_REG   0x64
 
 /*
- * dev>iobase Register Map
+ * dev->iobase Register Map
  */
-#define APCI1564_TCW_REG(x)(0x00 + ((x) * 0x20))
-#define APCI1564_TCW_RELOAD_REG(x) (0x04 + ((x) * 0x20))
-#define APCI1564_TCW_TIMEBASE_REG(x)   (0x08 + ((x) * 0x20))
-#define APCI1564_TCW_CTRL_REG(x)   (0x0c + ((x) * 0x20))
-#define APCI1564_TCW_STATUS_REG(x) (0x10 + ((x) * 0x20))
-#define APCI1564_TCW_IRQ_REG(x)(0x14 + ((x) * 
0x20))
-#define APCI1564_TCW_WARN_TIMEVAL_REG(x)   (0x18 + ((x) * 0x20))
-#define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
+#define APCI1564_COUNTER_REG(x)(0x00 + ((x) * 
0x20))
+#define APCI1564_COUNTER_RELOAD_REG(x) (0x04 + ((x) * 0x20))
+#define APCI1564_COUNTER_TIMEBASE_REG(x)   (0x08 + ((x) * 0x20))
+#define APCI1564_COUNTER_CTRL_REG(x)   (0x0c + ((x) * 0x20))
+#define APCI1564_COUNTER_STATUS_REG(x) (0x10 + ((x) * 0x20))
+#define APCI1564_COUNTER_IRQ_REG(x)(0x14 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEVAL_REG(x)   (0x18 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
  * Configures The Timer or Counter
@@ -121,14 +119,14 @@ static int apci1564_timer_config(struct comedi_device 
*dev,
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DO_IRQ_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_WDOG_IRQ_REG);
-   outl(0x0,
-dev->iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1));
-   outl(0x0,
-dev->iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2));
-   outl(0x0,
-dev->iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3));
-   outl(0x0,
-dev->iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4));
+   outl(0x0, dev->iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER1));
+   outl(0x0, dev->iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER2));
+   outl(0x0, dev->iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER3));
+   outl(0x0, dev->i

[PATCH 2/3] staging: comedi: addi_apci_1564: Remove in-driver watchdog support code

2014-08-11 Thread Chase Southwood
Starting with commit 1496e5961113 ("staging: comedi: addi_apci_1564: use
addi_watchdog module to init watchdog subdevice"), this driver uses the
addi_watchdog module to provide support for the watchdog subdevice.  Any
remaining watchdog code in-driver can and should be removed.

This will also make future work on the timer and counter subdevices easier.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 54 +-
 1 file changed, 12 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 0ce1deb..f8d8cc9 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -88,9 +88,9 @@
 #define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
- * Configures The Timer, Counter or Watchdog
+ * Configures The Timer or Counter
  *
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
  * data[1] 1 = Enable Interrupt, 0 = Disable Interrupt
  * data[2] Time Unit
  * data[3] Reload Value
@@ -107,14 +107,7 @@ static int apci1564_timer_config(struct comedi_device *dev,
unsigned int ul_Command1 = 0;
 
devpriv->tsk_current = current;
-   if (data[0] == ADDIDATA_WATCHDOG) {
-   devpriv->timer_select_mode = ADDIDATA_WATCHDOG;
-
-   /* Disable the watchdog */
-   outl(0x0, devpriv->amcc_iobase + APCI1564_WDOG_CTRL_REG);
-   /* Loading the Reload value */
-   outl(data[3], devpriv->amcc_iobase + APCI1564_WDOG_RELOAD_REG);
-   } else if (data[0] == ADDIDATA_TIMER) {
+   if (data[0] == ADDIDATA_TIMER) {
/* First Stop The Timer */
ul_Command1 = inl(devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
ul_Command1 = ul_Command1 & 0xF9FEUL;
@@ -187,14 +180,13 @@ static int apci1564_timer_config(struct comedi_device 
*dev,
} else {
dev_err(dev->class_dev, "Invalid subdevice.\n");
}
-
return insn->n;
 }
 
 /*
- * Start / Stop The Selected Timer, Counter or Watchdog
+ * Start / Stop The Selected Timer or Counter
  *
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
  * data[1] 0 = Stop, 1 = Start, 2 = Trigger Clear (Only Counter)
  */
 static int apci1564_timer_write(struct comedi_device *dev,
@@ -205,23 +197,6 @@ static int apci1564_timer_write(struct comedi_device *dev,
struct apci1564_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
 
-   if (devpriv->timer_select_mode == ADDIDATA_WATCHDOG) {
-   switch (data[1]) {
-   case 0: /* stop the watchdog */
-   /* disable the watchdog */
-   outl(0x0, devpriv->amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   case 1: /* start the watchdog */
-   outl(0x0001, devpriv->amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   case 2: /* Software trigger */
-   outl(0x0201, devpriv->amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   default:
-   dev_err(dev->class_dev, "Specified functionality does 
not exist.\n");
-   return -EINVAL;
-   }
-   }
if (devpriv->timer_select_mode == ADDIDATA_TIMER) {
if (data[1] == 1) {
ul_Command1 = inl(devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
@@ -236,8 +211,7 @@ static int apci1564_timer_write(struct comedi_device *dev,
ul_Command1 = ul_Command1 & 0xF9FEUL;
outl(ul_Command1, devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
}
-   }
-   if (devpriv->timer_select_mode == ADDIDATA_COUNTER) {
+   } else if (devpriv->timer_select_mode == ADDIDATA_COUNTER) {
ul_Command1 =
inl(dev->iobase +
APCI1564_TCW_CTRL_REG(devpriv->mode_select_register 
- 1));
@@ -254,12 +228,14 @@ static int apci1564_timer_write(struct comedi_device *dev,
}
outl(ul_Command1, dev->iobase +
 APCI1564_TCW_CTRL_REG(devpriv->mode_select_register - 1));
+   } else {
+   dev_err(dev->class_dev, "Invalid subdevice.\n");
}
return insn->n;
 }
 
 /*
- * Read The Selected Timer, Counter or Watchdog
+ * Read The Selected Timer or Counter
  */
 static int apci1564_timer_read(struct comedi_device *dev,

[PATCH 1/3] staging: comedi: addi_apci_1564: remove apci1564_do_config

2014-08-11 Thread Chase Southwood
The DO config function served the purpose of configuring the diagnostic
interrupts for the board.  As the driver currently does not support
diagnostic interrupts, the digital output subdevice does not need an
insn_config operation and this function can be safely removed.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 34 --
 drivers/staging/comedi/drivers/addi_apci_1564.c|  1 -
 2 files changed, 35 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 8a613ae..0ce1deb 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -88,40 +88,6 @@
 #define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
- * Configures The Digital Output Subdevice.
- *
- * data[1] 0 = Disable VCC Interrupt, 1 = Enable VCC Interrupt
- * data[2] 0 = Disable CC Interrupt, 1 = Enable CC Interrupt
- */
-static int apci1564_do_config(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
-   struct apci1564_private *devpriv = dev->private;
-   unsigned int ul_Command = 0;
-
-   if ((data[0] != 0) && (data[0] != 1)) {
-   dev_err(dev->class_dev, "Data should be 1 or 0\n");
-   return -EINVAL;
-   }
-
-   if (data[1] == 1)
-   ul_Command = ul_Command | 0x1;
-   else
-   ul_Command = ul_Command & 0xFFFE;
-
-   if (data[2] == 1)
-   ul_Command = ul_Command | 0x2;
-   else
-   ul_Command = ul_Command & 0xFFFD;
-
-   outl(ul_Command, devpriv->amcc_iobase + APCI1564_DO_INT_CTRL_REG);
-   devpriv->tsk_current = current;
-   return insn->n;
-}
-
-/*
  * Configures The Timer, Counter or Watchdog
  *
  * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 543cb07..555e0a9 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -388,7 +388,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->n_chan = 32;
s->maxdata = 1;
s->range_table = _digital;
-   s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
 
/* Change-Of-State (COS) interrupt subdevice */
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] staging: comedi: addi_apci_1564: miscellaneous cleanups

2014-08-11 Thread Chase Southwood
This patchset removes an uncorrect and unneeded insn_config operation,
strips out remaining in-driver watchdog subdevice code, and cleans up the
driver's register map defines.

Chase Southwood (3):
  staging: comedi: addi_apci_1564: remove apci1564_do_config
  staging: comedi: addi_apci_1564: Remove in-driver watchdog support
code
  staging: comedi: addi_apci_1564: tidy register map defines

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 158 +++--
 drivers/staging/comedi/drivers/addi_apci_1564.c|  20 +--
 2 files changed, 60 insertions(+), 118 deletions(-)

-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] staging: comedi: addi_apci_1564: miscellaneous cleanups

2014-08-11 Thread Chase Southwood
This patchset removes an uncorrect and unneeded insn_config operation,
strips out remaining in-driver watchdog subdevice code, and cleans up the
driver's register map defines.

Chase Southwood (3):
  staging: comedi: addi_apci_1564: remove apci1564_do_config
  staging: comedi: addi_apci_1564: Remove in-driver watchdog support
code
  staging: comedi: addi_apci_1564: tidy register map defines

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 158 +++--
 drivers/staging/comedi/drivers/addi_apci_1564.c|  20 +--
 2 files changed, 60 insertions(+), 118 deletions(-)

-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: comedi: addi_apci_1564: remove apci1564_do_config

2014-08-11 Thread Chase Southwood
The DO config function served the purpose of configuring the diagnostic
interrupts for the board.  As the driver currently does not support
diagnostic interrupts, the digital output subdevice does not need an
insn_config operation and this function can be safely removed.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 34 --
 drivers/staging/comedi/drivers/addi_apci_1564.c|  1 -
 2 files changed, 35 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 8a613ae..0ce1deb 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -88,40 +88,6 @@
 #define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
- * Configures The Digital Output Subdevice.
- *
- * data[1] 0 = Disable VCC Interrupt, 1 = Enable VCC Interrupt
- * data[2] 0 = Disable CC Interrupt, 1 = Enable CC Interrupt
- */
-static int apci1564_do_config(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
-   struct apci1564_private *devpriv = dev-private;
-   unsigned int ul_Command = 0;
-
-   if ((data[0] != 0)  (data[0] != 1)) {
-   dev_err(dev-class_dev, Data should be 1 or 0\n);
-   return -EINVAL;
-   }
-
-   if (data[1] == 1)
-   ul_Command = ul_Command | 0x1;
-   else
-   ul_Command = ul_Command  0xFFFE;
-
-   if (data[2] == 1)
-   ul_Command = ul_Command | 0x2;
-   else
-   ul_Command = ul_Command  0xFFFD;
-
-   outl(ul_Command, devpriv-amcc_iobase + APCI1564_DO_INT_CTRL_REG);
-   devpriv-tsk_current = current;
-   return insn-n;
-}
-
-/*
  * Configures The Timer, Counter or Watchdog
  *
  * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 543cb07..555e0a9 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -388,7 +388,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-n_chan = 32;
s-maxdata = 1;
s-range_table = range_digital;
-   s-insn_config = apci1564_do_config;
s-insn_bits = apci1564_do_insn_bits;
 
/* Change-Of-State (COS) interrupt subdevice */
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: comedi: addi_apci_1564: tidy register map defines

2014-08-11 Thread Chase Southwood
This commit performs a final tidying of the register map defines, bringing
them to a state that is ready for merging into addi_apci_1564.c when the
time comes.  Actions performed include:

*Removes the APCI1564_ADDRESS_RANGE macro, which is no longer needed/used.
*Renames the APCI1564_DIGITAL_OP_{VCC,CC}_INTERRUPT_{ENABLE,DISABLE}
macros to shorter names which are more consistent with the digital input
interrupt macros.
*Fixes a typo in a comment (deviobase changed to dev-iobase).
*Renames the APCI1564_TCW_* macros to APCI1564_COUNTER_* names to more
accurately reflect that they are only offsets to counter registers (since
only the counters are offset from dev-iobase).

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengraver.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 70 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 19 +++---
 2 files changed, 48 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index f8d8cc9..198c627 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -21,8 +21,6 @@
  *
  */
 
-#define APCI1564_ADDRESS_RANGE 128
-
 /* Digital Input IRQ Function Selection */
 #define APCI1564_DI_INT_OR (0  1)
 #define APCI1564_DI_INT_AND(1  1)
@@ -32,10 +30,10 @@
 #define APCI1564_DI_INT_DISABLE0xfffb
 
 /* Digital Output Interrupt Enable Disable. */
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xfffe
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE0x2
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xfffd
+#define APCI1564_DO_VCC_INT_ENABLE 0x1
+#define APCI1564_DO_VCC_INT_DISABLE0xfffe
+#define APCI1564_DO_CC_INT_ENABLE  0x2
+#define APCI1564_DO_CC_IN_DISABLE  0xfffd
 
 /* TIMER COUNTER WATCHDOG DEFINES */
 #define ADDIDATA_TIMER 0
@@ -76,16 +74,16 @@
 #define APCI1564_TIMER_WARN_TIMEBASE_REG   0x64
 
 /*
- * deviobase Register Map
+ * dev-iobase Register Map
  */
-#define APCI1564_TCW_REG(x)(0x00 + ((x) * 0x20))
-#define APCI1564_TCW_RELOAD_REG(x) (0x04 + ((x) * 0x20))
-#define APCI1564_TCW_TIMEBASE_REG(x)   (0x08 + ((x) * 0x20))
-#define APCI1564_TCW_CTRL_REG(x)   (0x0c + ((x) * 0x20))
-#define APCI1564_TCW_STATUS_REG(x) (0x10 + ((x) * 0x20))
-#define APCI1564_TCW_IRQ_REG(x)(0x14 + ((x) * 
0x20))
-#define APCI1564_TCW_WARN_TIMEVAL_REG(x)   (0x18 + ((x) * 0x20))
-#define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
+#define APCI1564_COUNTER_REG(x)(0x00 + ((x) * 
0x20))
+#define APCI1564_COUNTER_RELOAD_REG(x) (0x04 + ((x) * 0x20))
+#define APCI1564_COUNTER_TIMEBASE_REG(x)   (0x08 + ((x) * 0x20))
+#define APCI1564_COUNTER_CTRL_REG(x)   (0x0c + ((x) * 0x20))
+#define APCI1564_COUNTER_STATUS_REG(x) (0x10 + ((x) * 0x20))
+#define APCI1564_COUNTER_IRQ_REG(x)(0x14 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEVAL_REG(x)   (0x18 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
  * Configures The Timer or Counter
@@ -121,14 +119,14 @@ static int apci1564_timer_config(struct comedi_device 
*dev,
outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
outl(0x0, devpriv-amcc_iobase + APCI1564_DO_IRQ_REG);
outl(0x0, devpriv-amcc_iobase + APCI1564_WDOG_IRQ_REG);
-   outl(0x0,
-dev-iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1));
-   outl(0x0,
-dev-iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2));
-   outl(0x0,
-dev-iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3));
-   outl(0x0,
-dev-iobase + 
APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4));
+   outl(0x0, dev-iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER1));
+   outl(0x0, dev-iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER2));
+   outl(0x0, dev-iobase +
+   APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER3));
+   outl(0x0, dev-iobase

[PATCH 2/3] staging: comedi: addi_apci_1564: Remove in-driver watchdog support code

2014-08-11 Thread Chase Southwood
Starting with commit 1496e5961113 (staging: comedi: addi_apci_1564: use
addi_watchdog module to init watchdog subdevice), this driver uses the
addi_watchdog module to provide support for the watchdog subdevice.  Any
remaining watchdog code in-driver can and should be removed.

This will also make future work on the timer and counter subdevices easier.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 54 +-
 1 file changed, 12 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 0ce1deb..f8d8cc9 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -88,9 +88,9 @@
 #define APCI1564_TCW_WARN_TIMEBASE_REG(x)  (0x1c + ((x) * 0x20))
 
 /*
- * Configures The Timer, Counter or Watchdog
+ * Configures The Timer or Counter
  *
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
  * data[1] 1 = Enable Interrupt, 0 = Disable Interrupt
  * data[2] Time Unit
  * data[3] Reload Value
@@ -107,14 +107,7 @@ static int apci1564_timer_config(struct comedi_device *dev,
unsigned int ul_Command1 = 0;
 
devpriv-tsk_current = current;
-   if (data[0] == ADDIDATA_WATCHDOG) {
-   devpriv-timer_select_mode = ADDIDATA_WATCHDOG;
-
-   /* Disable the watchdog */
-   outl(0x0, devpriv-amcc_iobase + APCI1564_WDOG_CTRL_REG);
-   /* Loading the Reload value */
-   outl(data[3], devpriv-amcc_iobase + APCI1564_WDOG_RELOAD_REG);
-   } else if (data[0] == ADDIDATA_TIMER) {
+   if (data[0] == ADDIDATA_TIMER) {
/* First Stop The Timer */
ul_Command1 = inl(devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
ul_Command1 = ul_Command1  0xF9FEUL;
@@ -187,14 +180,13 @@ static int apci1564_timer_config(struct comedi_device 
*dev,
} else {
dev_err(dev-class_dev, Invalid subdevice.\n);
}
-
return insn-n;
 }
 
 /*
- * Start / Stop The Selected Timer, Counter or Watchdog
+ * Start / Stop The Selected Timer or Counter
  *
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
  * data[1] 0 = Stop, 1 = Start, 2 = Trigger Clear (Only Counter)
  */
 static int apci1564_timer_write(struct comedi_device *dev,
@@ -205,23 +197,6 @@ static int apci1564_timer_write(struct comedi_device *dev,
struct apci1564_private *devpriv = dev-private;
unsigned int ul_Command1 = 0;
 
-   if (devpriv-timer_select_mode == ADDIDATA_WATCHDOG) {
-   switch (data[1]) {
-   case 0: /* stop the watchdog */
-   /* disable the watchdog */
-   outl(0x0, devpriv-amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   case 1: /* start the watchdog */
-   outl(0x0001, devpriv-amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   case 2: /* Software trigger */
-   outl(0x0201, devpriv-amcc_iobase + 
APCI1564_WDOG_CTRL_REG);
-   break;
-   default:
-   dev_err(dev-class_dev, Specified functionality does 
not exist.\n);
-   return -EINVAL;
-   }
-   }
if (devpriv-timer_select_mode == ADDIDATA_TIMER) {
if (data[1] == 1) {
ul_Command1 = inl(devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
@@ -236,8 +211,7 @@ static int apci1564_timer_write(struct comedi_device *dev,
ul_Command1 = ul_Command1  0xF9FEUL;
outl(ul_Command1, devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
}
-   }
-   if (devpriv-timer_select_mode == ADDIDATA_COUNTER) {
+   } else if (devpriv-timer_select_mode == ADDIDATA_COUNTER) {
ul_Command1 =
inl(dev-iobase +
APCI1564_TCW_CTRL_REG(devpriv-mode_select_register 
- 1));
@@ -254,12 +228,14 @@ static int apci1564_timer_write(struct comedi_device *dev,
}
outl(ul_Command1, dev-iobase +
 APCI1564_TCW_CTRL_REG(devpriv-mode_select_register - 1));
+   } else {
+   dev_err(dev-class_dev, Invalid subdevice.\n);
}
return insn-n;
 }
 
 /*
- * Read The Selected Timer, Counter or Watchdog
+ * Read The Selected Timer or Counter
  */
 static int apci1564_timer_read(struct comedi_device *dev,
   struct comedi_subdevice *s,
@@ -269,11 +245,7 @@ static int

[PATCH 2/2] staging: comedi: addi_apci_1564: remove diagnostic interrupt support code

2014-07-31 Thread Chase Southwood
As per Ian, at this point in time it is not worth implementing an async
command interface for diagnostic interrupts for this board.  As this is
the case, this patch removes the code which supports such interrupts as it
is now unused.

This includes removing apci1564_do_read(), which was the insn_read
operation for the digital output subdevice, since all it was doing was
reading the current diagnostic interrupt type and returning it in 'data'.
This doesn't follow the comedi API and this operation can be emulated by
the comedi core anyway since the insn_bits operation follows the comedi
API.  So it is safe to simply remove this function.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 .../staging/comedi/drivers/addi-data/hwdrv_apci1564.c  | 14 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 18 --
 2 files changed, 32 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index a1730e9..8a613ae 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -340,17 +340,3 @@ static int apci1564_timer_read(struct comedi_device *dev,
}
return insn->n;
 }
-
-/*
- * Reads the interrupt status register
- */
-static int apci1564_do_read(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn,
-   unsigned int *data)
-{
-   struct apci1564_private *devpriv = dev->private;
-
-   *data = devpriv->do_int_type;
-   return insn->n;
-}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 819255b..543cb07 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -13,7 +13,6 @@ struct apci1564_private {
unsigned int mode1; /* riding-edge/high level channels */
unsigned int mode2; /* falling-edge/low level channels */
unsigned int ctrl;  /* interrupt mode OR (edge) . AND 
(level) */
-   unsigned int do_int_type;
unsigned char timer_select_mode;
unsigned char mode_select_register;
struct task_struct *tsk_current;
@@ -25,8 +24,6 @@ static int apci1564_reset(struct comedi_device *dev)
 {
struct apci1564_private *devpriv = dev->private;
 
-   devpriv->do_int_type = 0;
-
/* Disable the input interrupts and reset status register */
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
inl(devpriv->amcc_iobase + APCI1564_DI_INT_STATUS_REG);
@@ -83,20 +80,6 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
outl(status, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
}
 
-   status = inl(devpriv->amcc_iobase + APCI1564_DO_IRQ_REG);
-   if (status & 0x01) {
-   /* Check for Digital Output interrupt Type */
-   /* 1: VCC interrupt*/
-   /* 2: CC interrupt */
-   devpriv->do_int_type = inl(devpriv->amcc_iobase +
- APCI1564_DO_INT_STATUS_REG) & 0x3;
-   /* Disable the  Interrupt */
-   outl(0x0, devpriv->amcc_iobase + APCI1564_DO_INT_CTRL_REG);
-
-   /* Sends signal to user space */
-   send_sig(SIGIO, devpriv->tsk_current, 0);
-   }
-
status = inl(devpriv->amcc_iobase + APCI1564_TIMER_IRQ_REG);
if (status & 0x01) {
/*  Disable Timer Interrupt */
@@ -407,7 +390,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->range_table = _digital;
s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
-   s->insn_read = apci1564_do_read;
 
/* Change-Of-State (COS) interrupt subdevice */
s = >subdevices[2];
-- 
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: comedi: addi_apci_1564: add subdevice to check diagnostic status

2014-07-31 Thread Chase Southwood
This board provides VCC/CC diagnostic information, and it also supports
diagnostic interrupts.  However, as per Ian, these interrupts aren't very
useful and it is enough to simply provide an interface for accessing the
diagnostic status on-demand.  This patch adds a 2-channel digital input
subdevice with an insn_bits handler to access this information.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 190b026..819255b 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -157,6 +157,18 @@ static int apci1564_do_insn_bits(struct comedi_device *dev,
return insn->n;
 }
 
+static int apci1564_diag_insn_bits(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_insn *insn,
+  unsigned int *data)
+{
+   struct apci1564_private *devpriv = dev->private;
+
+   data[1] = inl(devpriv->amcc_iobase + APCI1564_DO_INT_STATUS_REG) & 3;
+
+   return insn->n;
+}
+
 /*
  * Change-Of-State (COS) interrupt configuration
  *
@@ -373,7 +385,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->irq = pcidev->irq;
}
 
-   ret = comedi_alloc_subdevices(dev, 5);
+   ret = comedi_alloc_subdevices(dev, 6);
if (ret)
return ret;
 
@@ -434,6 +446,15 @@ static int apci1564_auto_attach(struct comedi_device *dev,
if (ret)
return ret;
 
+   /* Initialize the diagnostic status subdevice */
+   s = >subdevices[5];
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan = 2;
+   s->maxdata = 1;
+   s->range_table = _digital;
+   s->insn_bits = apci1564_diag_insn_bits;
+
return 0;
 }
 
-- 
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] staging: comedi: addi_apci_1564: provide interface to read diagnostic status

2014-07-31 Thread Chase Southwood
This patchset creates a simple subdevice to allow for reading of the
board's diagnostic status, and then removes any code which is related to
diagnostic interrupts, as the driver will not support these at this time.

Chase Southwood (2):
  staging: comedi: addi_apci_1564: add subdevice to check diagnostic
status
  staging: comedi: addi_apci_1564: remove diagnostic interrupt support
code

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 14 
 drivers/staging/comedi/drivers/addi_apci_1564.c| 41 --
 2 files changed, 22 insertions(+), 33 deletions(-)

-- 
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: comedi: addi_apci_1564: add subdevice to check diagnostic status

2014-07-31 Thread Chase Southwood
This board provides VCC/CC diagnostic information, and it also supports
diagnostic interrupts.  However, as per Ian, these interrupts aren't very
useful and it is enough to simply provide an interface for accessing the
diagnostic status on-demand.  This patch adds a 2-channel digital input
subdevice with an insn_bits handler to access this information.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 190b026..819255b 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -157,6 +157,18 @@ static int apci1564_do_insn_bits(struct comedi_device *dev,
return insn-n;
 }
 
+static int apci1564_diag_insn_bits(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_insn *insn,
+  unsigned int *data)
+{
+   struct apci1564_private *devpriv = dev-private;
+
+   data[1] = inl(devpriv-amcc_iobase + APCI1564_DO_INT_STATUS_REG)  3;
+
+   return insn-n;
+}
+
 /*
  * Change-Of-State (COS) interrupt configuration
  *
@@ -373,7 +385,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev-irq = pcidev-irq;
}
 
-   ret = comedi_alloc_subdevices(dev, 5);
+   ret = comedi_alloc_subdevices(dev, 6);
if (ret)
return ret;
 
@@ -434,6 +446,15 @@ static int apci1564_auto_attach(struct comedi_device *dev,
if (ret)
return ret;
 
+   /* Initialize the diagnostic status subdevice */
+   s = dev-subdevices[5];
+   s-type = COMEDI_SUBD_DI;
+   s-subdev_flags = SDF_READABLE;
+   s-n_chan = 2;
+   s-maxdata = 1;
+   s-range_table = range_digital;
+   s-insn_bits = apci1564_diag_insn_bits;
+
return 0;
 }
 
-- 
2.0.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] staging: comedi: addi_apci_1564: provide interface to read diagnostic status

2014-07-31 Thread Chase Southwood
This patchset creates a simple subdevice to allow for reading of the
board's diagnostic status, and then removes any code which is related to
diagnostic interrupts, as the driver will not support these at this time.

Chase Southwood (2):
  staging: comedi: addi_apci_1564: add subdevice to check diagnostic
status
  staging: comedi: addi_apci_1564: remove diagnostic interrupt support
code

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 14 
 drivers/staging/comedi/drivers/addi_apci_1564.c| 41 --
 2 files changed, 22 insertions(+), 33 deletions(-)

-- 
2.0.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: comedi: addi_apci_1564: remove diagnostic interrupt support code

2014-07-31 Thread Chase Southwood
As per Ian, at this point in time it is not worth implementing an async
command interface for diagnostic interrupts for this board.  As this is
the case, this patch removes the code which supports such interrupts as it
is now unused.

This includes removing apci1564_do_read(), which was the insn_read
operation for the digital output subdevice, since all it was doing was
reading the current diagnostic interrupt type and returning it in 'data'.
This doesn't follow the comedi API and this operation can be emulated by
the comedi core anyway since the insn_bits operation follows the comedi
API.  So it is safe to simply remove this function.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 .../staging/comedi/drivers/addi-data/hwdrv_apci1564.c  | 14 --
 drivers/staging/comedi/drivers/addi_apci_1564.c| 18 --
 2 files changed, 32 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index a1730e9..8a613ae 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -340,17 +340,3 @@ static int apci1564_timer_read(struct comedi_device *dev,
}
return insn-n;
 }
-
-/*
- * Reads the interrupt status register
- */
-static int apci1564_do_read(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn,
-   unsigned int *data)
-{
-   struct apci1564_private *devpriv = dev-private;
-
-   *data = devpriv-do_int_type;
-   return insn-n;
-}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 819255b..543cb07 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -13,7 +13,6 @@ struct apci1564_private {
unsigned int mode1; /* riding-edge/high level channels */
unsigned int mode2; /* falling-edge/low level channels */
unsigned int ctrl;  /* interrupt mode OR (edge) . AND 
(level) */
-   unsigned int do_int_type;
unsigned char timer_select_mode;
unsigned char mode_select_register;
struct task_struct *tsk_current;
@@ -25,8 +24,6 @@ static int apci1564_reset(struct comedi_device *dev)
 {
struct apci1564_private *devpriv = dev-private;
 
-   devpriv-do_int_type = 0;
-
/* Disable the input interrupts and reset status register */
outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
inl(devpriv-amcc_iobase + APCI1564_DI_INT_STATUS_REG);
@@ -83,20 +80,6 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
outl(status, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
}
 
-   status = inl(devpriv-amcc_iobase + APCI1564_DO_IRQ_REG);
-   if (status  0x01) {
-   /* Check for Digital Output interrupt Type */
-   /* 1: VCC interrupt*/
-   /* 2: CC interrupt */
-   devpriv-do_int_type = inl(devpriv-amcc_iobase +
- APCI1564_DO_INT_STATUS_REG)  0x3;
-   /* Disable the  Interrupt */
-   outl(0x0, devpriv-amcc_iobase + APCI1564_DO_INT_CTRL_REG);
-
-   /* Sends signal to user space */
-   send_sig(SIGIO, devpriv-tsk_current, 0);
-   }
-
status = inl(devpriv-amcc_iobase + APCI1564_TIMER_IRQ_REG);
if (status  0x01) {
/*  Disable Timer Interrupt */
@@ -407,7 +390,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-range_table = range_digital;
s-insn_config = apci1564_do_config;
s-insn_bits = apci1564_do_insn_bits;
-   s-insn_read = apci1564_do_read;
 
/* Change-Of-State (COS) interrupt subdevice */
s = dev-subdevices[2];
-- 
2.0.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-16 Thread Chase Southwood
On Tue, Jul 15, 2014 at 5:14 AM, Ian Abbott  wrote:
> On 2014-07-15 05:00, Chase Southwood wrote:
>>
>> On Mon, Jul 14, 2014 at 4:22 AM, Ian Abbott  wrote:
>>>
>>> On 2014-07-12 23:44, Chase Southwood wrote:
>>>>
>>>>
>>>> Use the addi_watchdog module to provide support for the watchdog
>>>> subdevice.
>>>>
>>>> Also, rearrange the subdevice init blocks so that the order makes sense.
>>>> Digital input/output subdevices and subdevices for DI/DO interrupt
>>>> support, followed by timer/counter/watchdog subdevices is the new order.
>>>>
>>>> Signed-off-by: Chase Southwood 
>>>> Cc: Ian Abbott 
>>>> Cc: H Hartley Sweeten 
>>>> ---
>>>>drivers/staging/comedi/drivers/addi_apci_1564.c | 34
>>>> +++--
>>>>1 file changed, 20 insertions(+), 14 deletions(-)
>>>
>>>
>>>
>>> I don't think the subdevice order matters that much, and I prefer to keep
>>> them stable, but since this driver is in such a state of flux, it doesn't
>>> really matter.
>>>
>>
>> Hi Ian!
>> Quick question here about this.  First off, duly noted that grouping
>> subdevices by function isn't necessary and I won't shuffle them around
>> like this in the future.  Second, the reason I stuck the watchdog at
>> the end is because it causes an early return if addi_watchdog_init()
>> returns an error and it seemed  appropriate at the end so it doesn't
>> prevent the initialization of any other subdevices if that call should
>> fail.  Now I realize that it is very unlikely that that call fails,
>> but in any case should I put future subdevice inits above the watchdog
>> for the same reason (so they aren't at risk of not getting
>> initialized), or does that count for subdevice order not being stable
>> and you would prefer them all to go at the end?
>
>
> Since you return an error from the auto_attach handler
> apci1564_auto_attach() when addi_watchdog_init() fails, it makes little
> difference what order the subdevices are initialized in.  The error from
> auto_attach handler causes the comedi core to call the detach handler
> apci1564_detach() and tear everything down.  Ultimately,
> comedi_pci_auto_attach() will return an error back to the PCI probe function
> apci1564_pci_probe(), which will propagate it to the PCI subsystem.
>
> In general, if adding a new subdevice, either add it to the end or replace
> an "unused" subdevice.
>

Oh excellent.  Perfect, that makes sense.  Thanks for taking the time
to explain, I'll make sure everything goes at the end from now on.

Thanks,
Chase

>
> --
> -=( Ian Abbott @ MEV Ltd.E-mail: )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-16 Thread Chase Southwood
On Tue, Jul 15, 2014 at 5:14 AM, Ian Abbott abbo...@mev.co.uk wrote:
 On 2014-07-15 05:00, Chase Southwood wrote:

 On Mon, Jul 14, 2014 at 4:22 AM, Ian Abbott abbo...@mev.co.uk wrote:

 On 2014-07-12 23:44, Chase Southwood wrote:


 Use the addi_watchdog module to provide support for the watchdog
 subdevice.

 Also, rearrange the subdevice init blocks so that the order makes sense.
 Digital input/output subdevices and subdevices for DI/DO interrupt
 support, followed by timer/counter/watchdog subdevices is the new order.

 Signed-off-by: Chase Southwood chase.southw...@gmail.com
 Cc: Ian Abbott abbo...@mev.co.uk
 Cc: H Hartley Sweeten hswee...@visionengravers.com
 ---
drivers/staging/comedi/drivers/addi_apci_1564.c | 34
 +++--
1 file changed, 20 insertions(+), 14 deletions(-)



 I don't think the subdevice order matters that much, and I prefer to keep
 them stable, but since this driver is in such a state of flux, it doesn't
 really matter.


 Hi Ian!
 Quick question here about this.  First off, duly noted that grouping
 subdevices by function isn't necessary and I won't shuffle them around
 like this in the future.  Second, the reason I stuck the watchdog at
 the end is because it causes an early return if addi_watchdog_init()
 returns an error and it seemed  appropriate at the end so it doesn't
 prevent the initialization of any other subdevices if that call should
 fail.  Now I realize that it is very unlikely that that call fails,
 but in any case should I put future subdevice inits above the watchdog
 for the same reason (so they aren't at risk of not getting
 initialized), or does that count for subdevice order not being stable
 and you would prefer them all to go at the end?


 Since you return an error from the auto_attach handler
 apci1564_auto_attach() when addi_watchdog_init() fails, it makes little
 difference what order the subdevices are initialized in.  The error from
 auto_attach handler causes the comedi core to call the detach handler
 apci1564_detach() and tear everything down.  Ultimately,
 comedi_pci_auto_attach() will return an error back to the PCI probe function
 apci1564_pci_probe(), which will propagate it to the PCI subsystem.

 In general, if adding a new subdevice, either add it to the end or replace
 an unused subdevice.


Oh excellent.  Perfect, that makes sense.  Thanks for taking the time
to explain, I'll make sure everything goes at the end from now on.

Thanks,
Chase


 --
 -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
 -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-14 Thread Chase Southwood
On Mon, Jul 14, 2014 at 4:22 AM, Ian Abbott  wrote:
> On 2014-07-12 23:44, Chase Southwood wrote:
>>
>> Use the addi_watchdog module to provide support for the watchdog
>> subdevice.
>>
>> Also, rearrange the subdevice init blocks so that the order makes sense.
>> Digital input/output subdevices and subdevices for DI/DO interrupt
>> support, followed by timer/counter/watchdog subdevices is the new order.
>>
>> Signed-off-by: Chase Southwood 
>> Cc: Ian Abbott 
>> Cc: H Hartley Sweeten 
>> ---
>>   drivers/staging/comedi/drivers/addi_apci_1564.c | 34
>> +++--
>>   1 file changed, 20 insertions(+), 14 deletions(-)
>
>
> I don't think the subdevice order matters that much, and I prefer to keep
> them stable, but since this driver is in such a state of flux, it doesn't
> really matter.
>

Hi Ian!
Quick question here about this.  First off, duly noted that grouping
subdevices by function isn't necessary and I won't shuffle them around
like this in the future.  Second, the reason I stuck the watchdog at
the end is because it causes an early return if addi_watchdog_init()
returns an error and it seemed  appropriate at the end so it doesn't
prevent the initialization of any other subdevices if that call should
fail.  Now I realize that it is very unlikely that that call fails,
but in any case should I put future subdevice inits above the watchdog
for the same reason (so they aren't at risk of not getting
initialized), or does that count for subdevice order not being stable
and you would prefer them all to go at the end?

Thanks,
Chase

> Reviewed-by: Ian Abbott 
>
> --
> -=( Ian Abbott @ MEV Ltd.E-mail: )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-14 Thread Chase Southwood
On Mon, Jul 14, 2014 at 4:22 AM, Ian Abbott abbo...@mev.co.uk wrote:
 On 2014-07-12 23:44, Chase Southwood wrote:

 Use the addi_watchdog module to provide support for the watchdog
 subdevice.

 Also, rearrange the subdevice init blocks so that the order makes sense.
 Digital input/output subdevices and subdevices for DI/DO interrupt
 support, followed by timer/counter/watchdog subdevices is the new order.

 Signed-off-by: Chase Southwood chase.southw...@gmail.com
 Cc: Ian Abbott abbo...@mev.co.uk
 Cc: H Hartley Sweeten hswee...@visionengravers.com
 ---
   drivers/staging/comedi/drivers/addi_apci_1564.c | 34
 +++--
   1 file changed, 20 insertions(+), 14 deletions(-)


 I don't think the subdevice order matters that much, and I prefer to keep
 them stable, but since this driver is in such a state of flux, it doesn't
 really matter.


Hi Ian!
Quick question here about this.  First off, duly noted that grouping
subdevices by function isn't necessary and I won't shuffle them around
like this in the future.  Second, the reason I stuck the watchdog at
the end is because it causes an early return if addi_watchdog_init()
returns an error and it seemed  appropriate at the end so it doesn't
prevent the initialization of any other subdevices if that call should
fail.  Now I realize that it is very unlikely that that call fails,
but in any case should I put future subdevice inits above the watchdog
for the same reason (so they aren't at risk of not getting
initialized), or does that count for subdevice order not being stable
and you would prefer them all to go at the end?

Thanks,
Chase

 Reviewed-by: Ian Abbott abbo...@mev.co.uk

 --
 -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
 -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-13 Thread Chase Southwood
On Sun, Jul 13, 2014 at 2:17 PM, Hartley Sweeten
 wrote:
> On Saturday, July 12, 2014 3:44 PM, Chase Southwood wrote:
>> Use the addi_watchdog module to provide support for the watchdog
>> subdevice.
>>
>> Also, rearrange the subdevice init blocks so that the order makes sense.
>> Digital input/output subdevices and subdevices for DI/DO interrupt
>> support, followed by timer/counter/watchdog subdevices is the new order.
>>
>> Signed-off-by: Chase Southwood 
>> Cc: Ian Abbott 
>> Cc: H Hartley Sweeten 
>> ---
>>  drivers/staging/comedi/drivers/addi_apci_1564.c | 34 
>> +++--
>>  1 file changed, 20 insertions(+), 14 deletions(-)
>
> Chase,
>
> You should also add the dependency for the addi watchdog module
> to the Kconfig.
>

Hello, Hartley!

The select statement for COMEDI_ADDI_WATCHDOG was added to Kconfig for
the addi_apci_1564 driver in commit
8851362:

From: Arnd Bergmann 
Date: Tue, 3 Jun 2014 12:29:29 +0200
Subject: [PATCH] staging: comedi: addi_apci_1564: add addi_watchdog dependency

Signed-off-by: Arnd Bergmann 
Cc: H Hartley Sweeten 
Acked-by: Ian Abbott 
Signed-off-by: Greg Kroah-Hartman 

This is because the driver has already been using
addi_watchdog_reset() and I had forgotten to add the select to the
Kconfig when I added that function call, so Arnd added it when a
randconfig build error turned up later.  Sorry for the
confusion.

Thanks,
Chase

> Regards,
> Hartley
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-13 Thread Chase Southwood
On Sun, Jul 13, 2014 at 2:17 PM, Hartley Sweeten
hartl...@visionengravers.com wrote:
 On Saturday, July 12, 2014 3:44 PM, Chase Southwood wrote:
 Use the addi_watchdog module to provide support for the watchdog
 subdevice.

 Also, rearrange the subdevice init blocks so that the order makes sense.
 Digital input/output subdevices and subdevices for DI/DO interrupt
 support, followed by timer/counter/watchdog subdevices is the new order.

 Signed-off-by: Chase Southwood chase.southw...@gmail.com
 Cc: Ian Abbott abbo...@mev.co.uk
 Cc: H Hartley Sweeten hswee...@visionengravers.com
 ---
  drivers/staging/comedi/drivers/addi_apci_1564.c | 34 
 +++--
  1 file changed, 20 insertions(+), 14 deletions(-)

 Chase,

 You should also add the dependency for the addi watchdog module
 to the Kconfig.


Hello, Hartley!

The select statement for COMEDI_ADDI_WATCHDOG was added to Kconfig for
the addi_apci_1564 driver in commit
8851362:

From: Arnd Bergmann a...@arndb.de
Date: Tue, 3 Jun 2014 12:29:29 +0200
Subject: [PATCH] staging: comedi: addi_apci_1564: add addi_watchdog dependency

Signed-off-by: Arnd Bergmann a...@arndb.de
Cc: H Hartley Sweeten hswee...@visionengravers.com
Acked-by: Ian Abbott abbo...@mev.co.uk
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

This is because the driver has already been using
addi_watchdog_reset() and I had forgotten to add the select to the
Kconfig when I added that function call, so Arnd added it when a
randconfig build error turned up later.  Sorry for the
confusion.

Thanks,
Chase

 Regards,
 Hartley
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-12 Thread Chase Southwood
Use the addi_watchdog module to provide support for the watchdog
subdevice.

Also, rearrange the subdevice init blocks so that the order makes sense.
Digital input/output subdevices and subdevices for DI/DO interrupt
support, followed by timer/counter/watchdog subdevices is the new order.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 34 +++--
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16f3b69..190b026 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -373,7 +373,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->irq = pcidev->irq;
}
 
-   ret = comedi_alloc_subdevices(dev, 4);
+   ret = comedi_alloc_subdevices(dev, 5);
if (ret)
return ret;
 
@@ -397,20 +397,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->insn_bits = apci1564_do_insn_bits;
s->insn_read = apci1564_do_read;
 
-   /*  Allocate and Initialise Timer Subdevice Structures */
-   s = >subdevices[2];
-   s->type = COMEDI_SUBD_TIMER;
-   s->subdev_flags = SDF_WRITEABLE;
-   s->n_chan = 1;
-   s->maxdata = 0;
-   s->len_chanlist = 1;
-   s->range_table = _digital;
-   s->insn_write = apci1564_timer_write;
-   s->insn_read = apci1564_timer_read;
-   s->insn_config = apci1564_timer_config;
-
/* Change-Of-State (COS) interrupt subdevice */
-   s = >subdevices[3];
+   s = >subdevices[2];
if (dev->irq) {
dev->read_subdev = s;
s->type = COMEDI_SUBD_DI;
@@ -428,6 +416,24 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}
 
+   /*  Allocate and Initialise Timer Subdevice Structures */
+   s = >subdevices[3];
+   s->type = COMEDI_SUBD_TIMER;
+   s->subdev_flags = SDF_WRITEABLE;
+   s->n_chan = 1;
+   s->maxdata = 0;
+   s->len_chanlist = 1;
+   s->range_table = _digital;
+   s->insn_write = apci1564_timer_write;
+   s->insn_read = apci1564_timer_read;
+   s->insn_config = apci1564_timer_config;
+
+   /* Initialize the watchdog subdevice */
+   s = >subdevices[4];
+   ret = addi_watchdog_init(s, devpriv->amcc_iobase + APCI1564_WDOG_REG);
+   if (ret)
+   return ret;
+
return 0;
 }
 
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: comedi: addi_apci_1564: driver no longer needs to include addi_common.h

2014-07-12 Thread Chase Southwood
This driver no longer depends on anything in addi_common.h, save for a
few headers that it was including indirectly.  Remove the include of
addi_common.h and add the includes of 
and  directly.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 1e25342..16f3b69 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -1,13 +1,13 @@
 #include 
 #include 
+#include 
+#include 
 
 #include "../comedidev.h"
 #include "comedi_fc.h"
 #include "amcc_s5933.h"
 #include "addi_watchdog.h"
 
-#include "addi-data/addi_common.h"
-
 struct apci1564_private {
unsigned int amcc_iobase;   /* base of AMCC I/O registers */
unsigned int mode1; /* riding-edge/high level channels */
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: comedi: addi_apci_1564: driver no longer needs to include addi_common.h

2014-07-12 Thread Chase Southwood
This driver no longer depends on anything in addi_common.h, save for a
few headers that it was including indirectly.  Remove the include of
addi_common.h and add the includes of linux/interrupt.h
and linux/sched.h directly.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 1e25342..16f3b69 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -1,13 +1,13 @@
 #include linux/module.h
 #include linux/pci.h
+#include linux/interrupt.h
+#include linux/sched.h
 
 #include ../comedidev.h
 #include comedi_fc.h
 #include amcc_s5933.h
 #include addi_watchdog.h
 
-#include addi-data/addi_common.h
-
 struct apci1564_private {
unsigned int amcc_iobase;   /* base of AMCC I/O registers */
unsigned int mode1; /* riding-edge/high level channels */
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-12 Thread Chase Southwood
Use the addi_watchdog module to provide support for the watchdog
subdevice.

Also, rearrange the subdevice init blocks so that the order makes sense.
Digital input/output subdevices and subdevices for DI/DO interrupt
support, followed by timer/counter/watchdog subdevices is the new order.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 34 +++--
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 16f3b69..190b026 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -373,7 +373,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev-irq = pcidev-irq;
}
 
-   ret = comedi_alloc_subdevices(dev, 4);
+   ret = comedi_alloc_subdevices(dev, 5);
if (ret)
return ret;
 
@@ -397,20 +397,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-insn_bits = apci1564_do_insn_bits;
s-insn_read = apci1564_do_read;
 
-   /*  Allocate and Initialise Timer Subdevice Structures */
-   s = dev-subdevices[2];
-   s-type = COMEDI_SUBD_TIMER;
-   s-subdev_flags = SDF_WRITEABLE;
-   s-n_chan = 1;
-   s-maxdata = 0;
-   s-len_chanlist = 1;
-   s-range_table = range_digital;
-   s-insn_write = apci1564_timer_write;
-   s-insn_read = apci1564_timer_read;
-   s-insn_config = apci1564_timer_config;
-
/* Change-Of-State (COS) interrupt subdevice */
-   s = dev-subdevices[3];
+   s = dev-subdevices[2];
if (dev-irq) {
dev-read_subdev = s;
s-type = COMEDI_SUBD_DI;
@@ -428,6 +416,24 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-type = COMEDI_SUBD_UNUSED;
}
 
+   /*  Allocate and Initialise Timer Subdevice Structures */
+   s = dev-subdevices[3];
+   s-type = COMEDI_SUBD_TIMER;
+   s-subdev_flags = SDF_WRITEABLE;
+   s-n_chan = 1;
+   s-maxdata = 0;
+   s-len_chanlist = 1;
+   s-range_table = range_digital;
+   s-insn_write = apci1564_timer_write;
+   s-insn_read = apci1564_timer_read;
+   s-insn_config = apci1564_timer_config;
+
+   /* Initialize the watchdog subdevice */
+   s = dev-subdevices[4];
+   ret = addi_watchdog_init(s, devpriv-amcc_iobase + APCI1564_WDOG_REG);
+   if (ret)
+   return ret;
+
return 0;
 }
 
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] staging: comedi: addi_apci_1564: fix s->maxdata assignment in do subdevice init.

2014-07-10 Thread Chase Southwood
s->maxdata for the do subdevice should be 1, however currently it is
being set to 0x.  Fix this.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
This patch is at the end because I'm somewhat uncertain of its
correctness.  Every other addi_apci_* driver with a digital output
subdevice sets s->maxdata to 1 so I'd be surprised if just this board
differed, but I'm not familiar enough with the hardware to verify that
myself.  I'd appreciate a verification that this is a correct change.
Thanks!

 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f91aedd..1e25342 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -391,7 +391,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 32;
-   s->maxdata = 0x;
+   s->maxdata = 1;
s->range_table = _digital;
s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] staging: comedi: addi_apci_1564: remove unnecessary dev->board_name initialization

2014-07-10 Thread Chase Southwood
The dev->board_name is now initialized by the comedi core before calling
the(*attach) or (*auto_attach) function in a driver. As long as the driver
does no additional probing, it's no longer necessary initialize the board_name.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 675054f..e3dcab7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -353,8 +353,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
int ret;
 
-   dev->board_name = dev->driver->driver_name;
-
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: addi_apci_1564: remove null check of devpriv in apci1564_detach()

2014-07-10 Thread Chase Southwood
There is no need to test whether devpriv is null in this function.  The
check looks left over and we can just remove it.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index e3dcab7..f91aedd 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -433,14 +433,10 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
 static void apci1564_detach(struct comedi_device *dev)
 {
-   struct apci1564_private *devpriv = dev->private;
-
-   if (devpriv) {
-   if (dev->iobase)
-   apci1564_reset(dev);
-   if (dev->irq)
-   free_irq(dev->irq, dev);
-   }
+   if (dev->iobase)
+   apci1564_reset(dev);
+   if (dev->irq)
+   free_irq(dev->irq, dev);
comedi_pci_disable(dev);
 }
 
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] staging: comedi: addi_apci_1564: remove len_chanlist from di and do subdevices

2014-07-10 Thread Chase Southwood
This value is only needed for subdevices that support async commands.
The comedi core will default the value to 1 when it is not initialized.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 5924421..675054f 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -385,7 +385,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->subdev_flags = SDF_READABLE;
s->n_chan = 32;
s->maxdata = 1;
-   s->len_chanlist = 32;
s->range_table = _digital;
s->insn_bits = apci1564_di_insn_bits;
 
@@ -395,7 +394,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 32;
s->maxdata = 0x;
-   s->len_chanlist = 32;
s->range_table = _digital;
s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

2014-07-10 Thread Chase Southwood
This is a small patchset containing a handful of fixes to the ADDI-DATA
APCI1564 driver that I would like to get out of the way before I forget
to take care of them.  From here, I will move to start fixing the
digital input/timer/counters/watchdog functionality of the board.

Chase Southwood (4):
  staging: comedi: addi_apci_1564: remove len_chanlist from di and do
subdevices
  staging: comedi: addi_apci_1564: remove unnecessary dev->board_name
initialization
  staging: comedi: addi_apci_1564: remove null check of devpriv in
apci1564_detach()
  staging: comedi: addi_apci_1564: fix s->maxdata assignment in do
subdevice init.

 drivers/staging/comedi/drivers/addi_apci_1564.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

2014-07-10 Thread Chase Southwood
This is a small patchset containing a handful of fixes to the ADDI-DATA
APCI1564 driver that I would like to get out of the way before I forget
to take care of them.  From here, I will move to start fixing the
digital input/timer/counters/watchdog functionality of the board.

Chase Southwood (4):
  staging: comedi: addi_apci_1564: remove len_chanlist from di and do
subdevices
  staging: comedi: addi_apci_1564: remove unnecessary dev-board_name
initialization
  staging: comedi: addi_apci_1564: remove null check of devpriv in
apci1564_detach()
  staging: comedi: addi_apci_1564: fix s-maxdata assignment in do
subdevice init.

 drivers/staging/comedi/drivers/addi_apci_1564.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] staging: comedi: addi_apci_1564: remove len_chanlist from di and do subdevices

2014-07-10 Thread Chase Southwood
This value is only needed for subdevices that support async commands.
The comedi core will default the value to 1 when it is not initialized.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 5924421..675054f 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -385,7 +385,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-subdev_flags = SDF_READABLE;
s-n_chan = 32;
s-maxdata = 1;
-   s-len_chanlist = 32;
s-range_table = range_digital;
s-insn_bits = apci1564_di_insn_bits;
 
@@ -395,7 +394,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-subdev_flags = SDF_WRITEABLE;
s-n_chan = 32;
s-maxdata = 0x;
-   s-len_chanlist = 32;
s-range_table = range_digital;
s-insn_config = apci1564_do_config;
s-insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] staging: comedi: addi_apci_1564: fix s-maxdata assignment in do subdevice init.

2014-07-10 Thread Chase Southwood
s-maxdata for the do subdevice should be 1, however currently it is
being set to 0x.  Fix this.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
This patch is at the end because I'm somewhat uncertain of its
correctness.  Every other addi_apci_* driver with a digital output
subdevice sets s-maxdata to 1 so I'd be surprised if just this board
differed, but I'm not familiar enough with the hardware to verify that
myself.  I'd appreciate a verification that this is a correct change.
Thanks!

 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f91aedd..1e25342 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -391,7 +391,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s-type = COMEDI_SUBD_DO;
s-subdev_flags = SDF_WRITEABLE;
s-n_chan = 32;
-   s-maxdata = 0x;
+   s-maxdata = 1;
s-range_table = range_digital;
s-insn_config = apci1564_do_config;
s-insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] staging: comedi: addi_apci_1564: remove unnecessary dev-board_name initialization

2014-07-10 Thread Chase Southwood
The dev-board_name is now initialized by the comedi core before calling
the(*attach) or (*auto_attach) function in a driver. As long as the driver
does no additional probing, it's no longer necessary initialize the board_name.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 675054f..e3dcab7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -353,8 +353,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
int ret;
 
-   dev-board_name = dev-driver-driver_name;
-
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] staging: comedi: addi_apci_1564: remove null check of devpriv in apci1564_detach()

2014-07-10 Thread Chase Southwood
There is no need to test whether devpriv is null in this function.  The
check looks left over and we can just remove it.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index e3dcab7..f91aedd 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -433,14 +433,10 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
 static void apci1564_detach(struct comedi_device *dev)
 {
-   struct apci1564_private *devpriv = dev-private;
-
-   if (devpriv) {
-   if (dev-iobase)
-   apci1564_reset(dev);
-   if (dev-irq)
-   free_irq(dev-irq, dev);
-   }
+   if (dev-iobase)
+   apci1564_reset(dev);
+   if (dev-irq)
+   free_irq(dev-irq, dev);
comedi_pci_disable(dev);
 }
 
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-03 Thread Chase Southwood
On Thu, Jul 3, 2014 at 4:39 AM, Ian Abbott  wrote:
> On 2014-07-03 03:15, Chase Southwood wrote:
>>
>> This patchset moves a misplaced include to the proper file, swaps out an
>> overly
>> aggressive placement of apci1564_reset(), and cleans up
>> apci1564_interrupt().
>>
>> Chase Southwood (3):
>>staging: comedi: addi_apci_1564: move addi_watchdog.h include to
>>  addi_apci_1564.c
>>staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
>>  disable DI interrupts
>>staging: comedi: addi_apci_1564: clean up apci1564_interrupt()
>>
>>   .../comedi/drivers/addi-data/hwdrv_apci1564.c  |   2 -
>>   drivers/staging/comedi/drivers/addi_apci_1564.c| 139
>> +
>>   2 files changed, 32 insertions(+), 109 deletions(-)
>>
>
> Looks good!  You didn't list the v2 changes though.  Maybe you could
> summarize them here?

I always forget to do _something_, don't I?  Here are the changes:

CHANGES FROM V1:
*Patches 1 and 2 did not change.
*In Patch 3, check for interrupts from unknown sources has been removed.
*Individual status variables for the subdevices in the interrupt
handler have been swapped out in favor of a single status variable
that is reused for all subdevices.

Thanks,
Chase
>
> Reviewed-by: Ian Abbott 
>
>
> --
> -=( Ian Abbott @ MEV Ltd.E-mail: )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-03 Thread Chase Southwood
On Thu, Jul 3, 2014 at 4:39 AM, Ian Abbott abbo...@mev.co.uk wrote:
 On 2014-07-03 03:15, Chase Southwood wrote:

 This patchset moves a misplaced include to the proper file, swaps out an
 overly
 aggressive placement of apci1564_reset(), and cleans up
 apci1564_interrupt().

 Chase Southwood (3):
staging: comedi: addi_apci_1564: move addi_watchdog.h include to
  addi_apci_1564.c
staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
  disable DI interrupts
staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

   .../comedi/drivers/addi-data/hwdrv_apci1564.c  |   2 -
   drivers/staging/comedi/drivers/addi_apci_1564.c| 139
 +
   2 files changed, 32 insertions(+), 109 deletions(-)


 Looks good!  You didn't list the v2 changes though.  Maybe you could
 summarize them here?

I always forget to do _something_, don't I?  Here are the changes:

CHANGES FROM V1:
*Patches 1 and 2 did not change.
*In Patch 3, check for interrupts from unknown sources has been removed.
*Individual status variables for the subdevices in the interrupt
handler have been swapped out in favor of a single status variable
that is reused for all subdevices.

Thanks,
Chase

 Reviewed-by: Ian Abbott abbo...@mev.co.uk.


 --
 -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
 -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/3] staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

2014-07-02 Thread Chase Southwood
Remove the checks for interrupts from unknown sources.  This situation
should never occur and the checks were doing nothing to help the
situation.

Also, the portion of the function for handling counter interrupts is
reapeated four times (once for each counter), but is completely identical
save for the register is is accessing, so we can handle all four counters
with a for loop.

Finally, the interrupt handler is incorrectly setting and then checking
devpriv->timer_select_mode before processing some of the triggered
interrupts, so just remove all occurrences of this.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 133 +---
 1 file changed, 27 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 0141ed9..5924421 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -58,48 +58,33 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct apci1564_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
-   unsigned int ui_DO, ui_DI;
-   unsigned int ui_Timer;
-   unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
-   unsigned int ul_Command2 = 0;
+   unsigned int status;
+   unsigned int ctrl;
+   unsigned int chan;
 
/* check interrupt is from this device */
if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
 INTCSR_INTR_ASSERTED) == 0)
return IRQ_NONE;
 
-   /* check which interrupt was triggered */
-   ui_DI = inl(devpriv->amcc_iobase + APCI1564_DI_IRQ_REG) &
-  APCI1564_DI_INT_ENABLE;
-   ui_DO = inl(devpriv->amcc_iobase + APCI1564_DO_IRQ_REG) & 0x01;
-   ui_Timer = inl(devpriv->amcc_iobase + APCI1564_TIMER_IRQ_REG) & 0x01;
-   ui_C1 =
-   inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1)) & 
0x1;
-   ui_C2 =
-   inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2)) & 
0x1;
-   ui_C3 =
-   inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3)) & 
0x1;
-   ui_C4 =
-   inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4)) & 
0x1;
-   if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && ui_C1 == 0
-   && ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) {
-   return IRQ_HANDLED;
-   }
-
-   if (ui_DI) {
+   status = inl(devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
+   if (status & APCI1564_DI_INT_ENABLE) {
/* disable the interrupt */
-   outl(ui_DI & APCI1564_DI_INT_DISABLE, devpriv->amcc_iobase + 
APCI1564_DI_IRQ_REG);
+   outl(status & APCI1564_DI_INT_DISABLE,
+devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
 
-   s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG) & 
0x;
+   s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG)
+  & 0x;
comedi_buf_put(s, s->state);
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
comedi_event(dev, s);
 
/* enable the interrupt */
-   outl(ui_DI, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
+   outl(status, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
}
 
-   if (ui_DO == 1) {
+   status = inl(devpriv->amcc_iobase + APCI1564_DO_IRQ_REG);
+   if (status & 0x01) {
/* Check for Digital Output interrupt Type */
/* 1: VCC interrupt*/
/* 2: CC interrupt */
@@ -112,98 +97,34 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
send_sig(SIGIO, devpriv->tsk_current, 0);
}
 
-   if (ui_Timer == 1) {
-   devpriv->timer_select_mode = ADDIDATA_TIMER;
-   if (devpriv->timer_select_mode) {
-
-   /*  Disable Timer Interrupt */
-   ul_Command2 = inl(devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   outl(0x0, devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-
-   /* Send a signal to from kernel to user space */
-   send_sig(SIGIO, devpriv->tsk_current, 0);
-
-   /*  Enable Timer Interrupt */
-
-   outl(ul_Command2, devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   }
-   }
-
-   if (ui_C1 == 1) {
-   devpriv->timer_select_mode = ADDIDATA_COUNTER;
-   if (devpriv->timer

[PATCH v2 1/3] staging: comedi: addi_apci_1564: move addi_watchdog.h include to addi_apci_1564.c

2014-07-02 Thread Chase Southwood
Commit aed3f9d (staging: comedi: addi_apci_1564: absorb apci1564_reset()) moved
the only use of addi_watchdog.h from hwdrv_apci1564.c to addi_apci_1564.c, but
left the include statement itself in the former file.  Move this include to the
file which actually uses it.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 --
 drivers/staging/comedi/drivers/addi_apci_1564.c   | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 4007fd2..7326f3a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -21,8 +21,6 @@
  *
  */
 
-#include "../addi_watchdog.h"
-
 #define APCI1564_ADDRESS_RANGE 128
 
 /* Digital Input IRQ Function Selection */
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f71ee02..59786e7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -4,6 +4,7 @@
 #include "../comedidev.h"
 #include "comedi_fc.h"
 #include "amcc_s5933.h"
+#include "addi_watchdog.h"
 
 #include "addi-data/addi_common.h"
 
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/3] staging: comedi: addi_apci_1564: fix use of apci1564_reset() to disable DI interrupts

2014-07-02 Thread Chase Southwood
apci1564_cos_insn_config() is currently using apci1564_reset() to disable
digital input interrupts when the configuration operation is
COMEDI_DIGITAL_TRIG_DISABLE.  However, this is incorrect as the device reset
function also resets the registers for the digital outputs, timer, watchdog, and
counters as well.  Replace the reset function call with a direct disabling of
just the digital input interrupts.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 59786e7..0141ed9 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -285,7 +285,10 @@ static int apci1564_cos_insn_config(struct comedi_device 
*dev,
devpriv->ctrl = 0;
devpriv->mode1 = 0;
devpriv->mode2 = 0;
-   apci1564_reset(dev);
+   outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
+   inl(devpriv->amcc_iobase + APCI1564_DI_INT_STATUS_REG);
+   outl(0x0, devpriv->amcc_iobase + 
APCI1564_DI_INT_MODE1_REG);
+   outl(0x0, devpriv->amcc_iobase + 
APCI1564_DI_INT_MODE2_REG);
break;
case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE |
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-02 Thread Chase Southwood
This patchset moves a misplaced include to the proper file, swaps out an overly
aggressive placement of apci1564_reset(), and cleans up apci1564_interrupt().

Chase Southwood (3):
  staging: comedi: addi_apci_1564: move addi_watchdog.h include to
addi_apci_1564.c
  staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
disable DI interrupts
  staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  |   2 -
 drivers/staging/comedi/drivers/addi_apci_1564.c| 139 +
 2 files changed, 32 insertions(+), 109 deletions(-)

-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-02 Thread Chase Southwood
This patchset moves a misplaced include to the proper file, swaps out an overly
aggressive placement of apci1564_reset(), and cleans up apci1564_interrupt().

Chase Southwood (3):
  staging: comedi: addi_apci_1564: move addi_watchdog.h include to
addi_apci_1564.c
  staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
disable DI interrupts
  staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

 .../comedi/drivers/addi-data/hwdrv_apci1564.c  |   2 -
 drivers/staging/comedi/drivers/addi_apci_1564.c| 139 +
 2 files changed, 32 insertions(+), 109 deletions(-)

-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/3] staging: comedi: addi_apci_1564: move addi_watchdog.h include to addi_apci_1564.c

2014-07-02 Thread Chase Southwood
Commit aed3f9d (staging: comedi: addi_apci_1564: absorb apci1564_reset()) moved
the only use of addi_watchdog.h from hwdrv_apci1564.c to addi_apci_1564.c, but
left the include statement itself in the former file.  Move this include to the
file which actually uses it.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 --
 drivers/staging/comedi/drivers/addi_apci_1564.c   | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 4007fd2..7326f3a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -21,8 +21,6 @@
  *
  */
 
-#include ../addi_watchdog.h
-
 #define APCI1564_ADDRESS_RANGE 128
 
 /* Digital Input IRQ Function Selection */
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f71ee02..59786e7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -4,6 +4,7 @@
 #include ../comedidev.h
 #include comedi_fc.h
 #include amcc_s5933.h
+#include addi_watchdog.h
 
 #include addi-data/addi_common.h
 
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/3] staging: comedi: addi_apci_1564: fix use of apci1564_reset() to disable DI interrupts

2014-07-02 Thread Chase Southwood
apci1564_cos_insn_config() is currently using apci1564_reset() to disable
digital input interrupts when the configuration operation is
COMEDI_DIGITAL_TRIG_DISABLE.  However, this is incorrect as the device reset
function also resets the registers for the digital outputs, timer, watchdog, and
counters as well.  Replace the reset function call with a direct disabling of
just the digital input interrupts.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 59786e7..0141ed9 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -285,7 +285,10 @@ static int apci1564_cos_insn_config(struct comedi_device 
*dev,
devpriv-ctrl = 0;
devpriv-mode1 = 0;
devpriv-mode2 = 0;
-   apci1564_reset(dev);
+   outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
+   inl(devpriv-amcc_iobase + APCI1564_DI_INT_STATUS_REG);
+   outl(0x0, devpriv-amcc_iobase + 
APCI1564_DI_INT_MODE1_REG);
+   outl(0x0, devpriv-amcc_iobase + 
APCI1564_DI_INT_MODE2_REG);
break;
case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
if (devpriv-ctrl != (APCI1564_DI_INT_ENABLE |
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/3] staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

2014-07-02 Thread Chase Southwood
Remove the checks for interrupts from unknown sources.  This situation
should never occur and the checks were doing nothing to help the
situation.

Also, the portion of the function for handling counter interrupts is
reapeated four times (once for each counter), but is completely identical
save for the register is is accessing, so we can handle all four counters
with a for loop.

Finally, the interrupt handler is incorrectly setting and then checking
devpriv-timer_select_mode before processing some of the triggered
interrupts, so just remove all occurrences of this.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 133 +---
 1 file changed, 27 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 0141ed9..5924421 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -58,48 +58,33 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct apci1564_private *devpriv = dev-private;
struct comedi_subdevice *s = dev-read_subdev;
-   unsigned int ui_DO, ui_DI;
-   unsigned int ui_Timer;
-   unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
-   unsigned int ul_Command2 = 0;
+   unsigned int status;
+   unsigned int ctrl;
+   unsigned int chan;
 
/* check interrupt is from this device */
if ((inl(devpriv-amcc_iobase + AMCC_OP_REG_INTCSR) 
 INTCSR_INTR_ASSERTED) == 0)
return IRQ_NONE;
 
-   /* check which interrupt was triggered */
-   ui_DI = inl(devpriv-amcc_iobase + APCI1564_DI_IRQ_REG) 
-  APCI1564_DI_INT_ENABLE;
-   ui_DO = inl(devpriv-amcc_iobase + APCI1564_DO_IRQ_REG)  0x01;
-   ui_Timer = inl(devpriv-amcc_iobase + APCI1564_TIMER_IRQ_REG)  0x01;
-   ui_C1 =
-   inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1))  
0x1;
-   ui_C2 =
-   inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2))  
0x1;
-   ui_C3 =
-   inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3))  
0x1;
-   ui_C4 =
-   inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4))  
0x1;
-   if (ui_DI == 0  ui_DO == 0  ui_Timer == 0  ui_C1 == 0
-ui_C2 == 0  ui_C3 == 0  ui_C4 == 0) {
-   return IRQ_HANDLED;
-   }
-
-   if (ui_DI) {
+   status = inl(devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
+   if (status  APCI1564_DI_INT_ENABLE) {
/* disable the interrupt */
-   outl(ui_DI  APCI1564_DI_INT_DISABLE, devpriv-amcc_iobase + 
APCI1564_DI_IRQ_REG);
+   outl(status  APCI1564_DI_INT_DISABLE,
+devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
 
-   s-state = inl(dev-iobase + APCI1564_DI_INT_STATUS_REG)  
0x;
+   s-state = inl(dev-iobase + APCI1564_DI_INT_STATUS_REG)
+   0x;
comedi_buf_put(s, s-state);
s-async-events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
comedi_event(dev, s);
 
/* enable the interrupt */
-   outl(ui_DI, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
+   outl(status, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG);
}
 
-   if (ui_DO == 1) {
+   status = inl(devpriv-amcc_iobase + APCI1564_DO_IRQ_REG);
+   if (status  0x01) {
/* Check for Digital Output interrupt Type */
/* 1: VCC interrupt*/
/* 2: CC interrupt */
@@ -112,98 +97,34 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
send_sig(SIGIO, devpriv-tsk_current, 0);
}
 
-   if (ui_Timer == 1) {
-   devpriv-timer_select_mode = ADDIDATA_TIMER;
-   if (devpriv-timer_select_mode) {
-
-   /*  Disable Timer Interrupt */
-   ul_Command2 = inl(devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   outl(0x0, devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-
-   /* Send a signal to from kernel to user space */
-   send_sig(SIGIO, devpriv-tsk_current, 0);
-
-   /*  Enable Timer Interrupt */
-
-   outl(ul_Command2, devpriv-amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   }
-   }
-
-   if (ui_C1 == 1) {
-   devpriv-timer_select_mode = ADDIDATA_COUNTER;
-   if (devpriv-timer_select_mode) {
-
-   /*  Disable Counter Interrupt */
-   ul_Command2 =
-   inl(dev-iobase + 
APCI1564_TCW_CTRL_REG

Re: [PATCH 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-01 Thread Chase Southwood
Hi all,

On Mon, Jun 30, 2014 at 5:25 AM, Ian Abbott  wrote:
> On 2014-06-28 05:47, Chase Southwood wrote:
>>
>> This patchset moves a misplaced include to the proper file, swaps out an
>> overly
>> aggressive placement of apci1564_reset(), and cleans up
>> apci1564_interrupt().
>>
>> Chase Southwood (3):
>>staging: comedi: addi_apci_1564: move addi_watchdog.h include to
>>  addi_apci_1564.c
>>staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
>>  disable DI interrupts
>>staging: comedi: addi_apci_1564: clean up apci1564_interrupt()
>>
>
> It's okay, but I think you can simplify the interrupt handling a bit more by
> not bothering to check for interrupts from unknown sources.   If a source
> hasn't been enabled, it shouldn't generate interrupts, right? Besides, since
> the does nothing to stop further interrupts from unknown sources, it would
> just keep getting further interrupts repeatedly in that case.
>
> Then you can get rid of the ui_DO, ui_DI, ui_Timer, and counters[] variables
> and just check the registers directly (e.g. replace 'if (ui_Timer == 1)'
> with 'if (inl(devpriv->amcc_iobase + APCI1564_TIMER_IRQ_REG) & 0x01)').

I received some more good comments about the interrupt function, and
looks like Greg is on vacation this week anyway, so I think I will
just redo patch 3 and send out a v2 patchset.

Thanks,
Chase
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] staging: comedi: addi_apci_1564: miscellaneous fixes and cleanups

2014-07-01 Thread Chase Southwood
Hi all,

On Mon, Jun 30, 2014 at 5:25 AM, Ian Abbott abbo...@mev.co.uk wrote:
 On 2014-06-28 05:47, Chase Southwood wrote:

 This patchset moves a misplaced include to the proper file, swaps out an
 overly
 aggressive placement of apci1564_reset(), and cleans up
 apci1564_interrupt().

 Chase Southwood (3):
staging: comedi: addi_apci_1564: move addi_watchdog.h include to
  addi_apci_1564.c
staging: comedi: addi_apci_1564: fix use of apci1564_reset() to
  disable DI interrupts
staging: comedi: addi_apci_1564: clean up apci1564_interrupt()


 It's okay, but I think you can simplify the interrupt handling a bit more by
 not bothering to check for interrupts from unknown sources.   If a source
 hasn't been enabled, it shouldn't generate interrupts, right? Besides, since
 the does nothing to stop further interrupts from unknown sources, it would
 just keep getting further interrupts repeatedly in that case.

 Then you can get rid of the ui_DO, ui_DI, ui_Timer, and counters[] variables
 and just check the registers directly (e.g. replace 'if (ui_Timer == 1)'
 with 'if (inl(devpriv-amcc_iobase + APCI1564_TIMER_IRQ_REG)  0x01)').

I received some more good comments about the interrupt function, and
looks like Greg is on vacation this week anyway, so I think I will
just redo patch 3 and send out a v2 patchset.

Thanks,
Chase
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: comedi: addi_apci_1564: clean up apci1564_interrupt()

2014-06-27 Thread Chase Southwood
The code in apci1564_interrupt() for handling counter interrupts is currently
repeated four times; once for each counter.  This code is identical save for the
registers it is using, so just handle all four counters with a for loop.

Also, the interrupt function was doing a useless set-and-check of
devpriv->timer_select_mode before processing any triggered interrupts, remove
all occurrences of this.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
Hartley,
I remember that you mentioned that the counters could be handled using a for
loop here.  Is there a better way to go about that or am I on the right track
with this?

Thanks,
Chase

 drivers/staging/comedi/drivers/addi_apci_1564.c | 108 +---
 1 file changed, 23 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 0141ed9..f40910e 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -60,8 +60,9 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
struct comedi_subdevice *s = dev->read_subdev;
unsigned int ui_DO, ui_DI;
unsigned int ui_Timer;
-   unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
+   unsigned int counters[4];
unsigned int ul_Command2 = 0;
+   int i;
 
/* check interrupt is from this device */
if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
@@ -73,16 +74,17 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
   APCI1564_DI_INT_ENABLE;
ui_DO = inl(devpriv->amcc_iobase + APCI1564_DO_IRQ_REG) & 0x01;
ui_Timer = inl(devpriv->amcc_iobase + APCI1564_TIMER_IRQ_REG) & 0x01;
-   ui_C1 =
+   counters[0] =
inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1)) & 
0x1;
-   ui_C2 =
+   counters[1] =
inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2)) & 
0x1;
-   ui_C3 =
+   counters[2] =
inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3)) & 
0x1;
-   ui_C4 =
+   counters[3] =
inl(dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4)) & 
0x1;
-   if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && ui_C1 == 0
-   && ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) {
+   if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && counters[0] == 0
+   && counters[1] == 0 && counters[2] == 0 && counters[3] == 0) {
+   dev_err(dev->class_dev, "Interrupt from unknown source.\n");
return IRQ_HANDLED;
}
 
@@ -113,95 +115,31 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
}
 
if (ui_Timer == 1) {
-   devpriv->timer_select_mode = ADDIDATA_TIMER;
-   if (devpriv->timer_select_mode) {
+   /*  Disable Timer Interrupt */
+   ul_Command2 = inl(devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
+   outl(0x0, devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
 
-   /*  Disable Timer Interrupt */
-   ul_Command2 = inl(devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   outl(0x0, devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-
-   /* Send a signal to from kernel to user space */
-   send_sig(SIGIO, devpriv->tsk_current, 0);
-
-   /*  Enable Timer Interrupt */
-
-   outl(ul_Command2, devpriv->amcc_iobase + 
APCI1564_TIMER_CTRL_REG);
-   }
-   }
-
-   if (ui_C1 == 1) {
-   devpriv->timer_select_mode = ADDIDATA_COUNTER;
-   if (devpriv->timer_select_mode) {
-
-   /*  Disable Counter Interrupt */
-   ul_Command2 =
-   inl(dev->iobase + 
APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
-   outl(0x0,
-dev->iobase + 
APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
-
-   /* Send a signal to from kernel to user space */
-   send_sig(SIGIO, devpriv->tsk_current, 0);
-
-   /*  Enable Counter Interrupt */
-   outl(ul_Command2,
-dev->iobase + 
APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
-   }
-   }
-
-   if (ui_C2 == 1) {
-   devpriv->timer_select_mode = ADDIDATA_COUNTER;
-   if (devpriv->timer_select_mode) {
-
-   /*  Disable Counter Interrupt */
-   ul_Command2 =
-   inl(dev->iobase + 
APCI1564_TCW_CTRL_RE

[PATCH 2/3] staging: comedi: addi_apci_1564: fix use of apci1564_reset() to disable DI interrupts

2014-06-27 Thread Chase Southwood
apci1564_cos_insn_config() is currently using apci1564_reset() to disable
digital input interrupts when the configuration operation is
COMEDI_DIGITAL_TRIG_DISABLE.  However, this is incorrect as the device reset
function also resets the registers for the digital outputs, timer, watchdog, and
counters as well.  Replace the reset function call with a direct disabling of
just the digital input interrupts.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 59786e7..0141ed9 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -285,7 +285,10 @@ static int apci1564_cos_insn_config(struct comedi_device 
*dev,
devpriv->ctrl = 0;
devpriv->mode1 = 0;
devpriv->mode2 = 0;
-   apci1564_reset(dev);
+   outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
+   inl(devpriv->amcc_iobase + APCI1564_DI_INT_STATUS_REG);
+   outl(0x0, devpriv->amcc_iobase + 
APCI1564_DI_INT_MODE1_REG);
+   outl(0x0, devpriv->amcc_iobase + 
APCI1564_DI_INT_MODE2_REG);
break;
case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE |
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   >