[PATCH 02/22] staging: comedi: adv_pci1710: remove 'has_counter' boardinfo

H Hartley Sweeten hsweeten at visionengravers.com
Wed Nov 4 16:55:16 UTC 2015


All the boards supported by this driver have a counter device. Remove
the unnecessary boardinfo.

This also fixes the pci1713 and pci1731 subdevice support. Those boards
have a counter but did not have the 'has_counter' boardinfo. This
prevented the subdevice from being allocated and initialized.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 032d1d4..f0d091a 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -138,7 +138,6 @@ struct boardtype {
 	unsigned int has_diff_ai:1;
 	unsigned int has_ao:1;
 	unsigned int has_di_do:1;
-	unsigned int has_counter:1;
 };
 
 static const struct boardtype boardtypes[] = {
@@ -151,7 +150,6 @@ static const struct boardtype boardtypes[] = {
 		.has_diff_ai	= 1,
 		.has_ao		= 1,
 		.has_di_do	= 1,
-		.has_counter	= 1,
 	},
 	[BOARD_PCI1710HG] = {
 		.name		= "pci1710hg",
@@ -162,7 +160,6 @@ static const struct boardtype boardtypes[] = {
 		.has_diff_ai	= 1,
 		.has_ao		= 1,
 		.has_di_do	= 1,
-		.has_counter	= 1,
 	},
 	[BOARD_PCI1711] = {
 		.name		= "pci1711",
@@ -171,7 +168,6 @@ static const struct boardtype boardtypes[] = {
 		.rangecode_ai	= range_codes_pci17x1,
 		.has_ao		= 1,
 		.has_di_do	= 1,
-		.has_counter	= 1,
 	},
 	[BOARD_PCI1713] = {
 		.name		= "pci1713",
@@ -784,15 +780,13 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 	if (!dev->pacer)
 		return -ENOMEM;
 
-	n_subdevices = 0;
+	n_subdevices = 1;	/* all boards have a counter */
 	if (board->n_aichan)
 		n_subdevices++;
 	if (board->has_ao)
 		n_subdevices++;
 	if (board->has_di_do)
 		n_subdevices += 2;
-	if (board->has_counter)
-		n_subdevices++;
 
 	ret = comedi_alloc_subdevices(dev, n_subdevices);
 	if (ret)
@@ -867,18 +861,16 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 	}
 
 	/* Counter subdevice (8254) */
-	if (board->has_counter) {
-		s = &dev->subdevices[subdev];
-		comedi_8254_subdevice_init(s, dev->pacer);
+	s = &dev->subdevices[subdev];
+	comedi_8254_subdevice_init(s, dev->pacer);
 
-		dev->pacer->insn_config = pci171x_insn_counter_config;
+	dev->pacer->insn_config = pci171x_insn_counter_config;
 
-		/* counters 1 and 2 are used internally for the pacer */
-		comedi_8254_set_busy(dev->pacer, 1, true);
-		comedi_8254_set_busy(dev->pacer, 2, true);
+	/* counters 1 and 2 are used internally for the pacer */
+	comedi_8254_set_busy(dev->pacer, 1, true);
+	comedi_8254_set_busy(dev->pacer, 2, true);
 
-		subdev++;
-	}
+	subdev++;
 
 	/* max_samples is half the FIFO size (2 bytes/sample) */
 	devpriv->max_samples = (board->has_large_fifo) ? 2048 : 512;
-- 
2.5.1



More information about the devel mailing list