[PATCH 20/87] staging: comedi: pcl818: all board types have digital inputs and outputs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All the board types have 16 digital inputs and 16 digital outputs.

Remove the 'n_dichan' and 'n_dochan' members in the boardinfo. Refactor
pcl818_attach() to always setup these subdevices.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcl818.c | 52 ++++++++++-----------------------
 1 file changed, 15 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index e709e3c..e206b78 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -263,8 +263,6 @@ struct pcl818_board {
 	int n_aichan_diff;
 	unsigned int ns_min;
 	int n_aochan;
-	int n_dichan;
-	int n_dochan;
 	const struct comedi_lrange *ai_range_type;
 	unsigned int IRQbits;
 	int ai_maxdata;
@@ -282,8 +280,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 25000,
 		.n_aochan	= 1,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818l_l_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -297,8 +293,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 10000,
 		.n_aochan	= 1,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818h_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -312,8 +306,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 10000,
 		.n_aochan	= 1,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818h_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -328,8 +320,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 10000,
 		.n_aochan	= 1,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818hg_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -344,8 +334,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 10000,
 		.n_aochan	= 2,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818h_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -359,8 +347,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_diff	= 8,
 		.ns_min		= 16000,
 		.n_aochan	= 2,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_unipolar5,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -372,8 +358,6 @@ static const struct pcl818_board boardtypes[] = {
 		.n_aichan_se	= 16,
 		.n_aichan_diff	= 8,
 		.ns_min		= 10000,
-		.n_dichan	= 16,
-		.n_dochan	= 16,
 		.ai_range_type	= &range_pcl818h_ai,
 		.IRQbits	= 0x00fc,
 		.ai_maxdata	= 0xfff,
@@ -1465,29 +1449,23 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		}
 	}
 
+	/* Digital Input subdevice */
 	s = &dev->subdevices[2];
-	if (!board->n_dichan) {
-		s->type = COMEDI_SUBD_UNUSED;
-	} else {
-		s->type = COMEDI_SUBD_DI;
-		s->subdev_flags = SDF_READABLE;
-		s->n_chan = board->n_dichan;
-		s->maxdata = 1;
-		s->range_table = &range_digital;
-		s->insn_bits = pcl818_di_insn_bits;
-	}
-
+	s->type		= COMEDI_SUBD_DI;
+	s->subdev_flags	= SDF_READABLE;
+	s->n_chan	= 16;
+	s->maxdata	= 1;
+	s->range_table	= &range_digital;
+	s->insn_bits	= pcl818_di_insn_bits;
+
+	/* Digital Output subdevice */
 	s = &dev->subdevices[3];
-	if (!board->n_dochan) {
-		s->type = COMEDI_SUBD_UNUSED;
-	} else {
-		s->type = COMEDI_SUBD_DO;
-		s->subdev_flags = SDF_WRITABLE;
-		s->n_chan = board->n_dochan;
-		s->maxdata = 1;
-		s->range_table = &range_digital;
-		s->insn_bits = pcl818_do_insn_bits;
-	}
+	s->type		= COMEDI_SUBD_DO;
+	s->subdev_flags	= SDF_WRITABLE;
+	s->n_chan	= 16;
+	s->maxdata	= 1;
+	s->range_table	= &range_digital;
+	s->insn_bits	= pcl818_do_insn_bits;
 
 	/* select 1/10MHz oscilator */
 	if ((it->options[3] == 0) || (it->options[3] == 10))
-- 
1.8.5.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux