lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1409569440-10979-13-git-send-email-abbotti@mev.co.uk>
Date:	Mon,  1 Sep 2014 12:03:44 +0100
From:	Ian Abbott <abbotti@....co.uk>
To:	driverdev-devel@...uxdriverproject.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Ian Abbott <abbotti@....co.uk>,
	H Hartley Sweeten <hartleys@...ionengravers.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 12/28] staging: comedi: amplc_pci230: remove ao_chans member

The PCI230(+) has an AO subdevice with 2 channels, but the PCI260(+) has
none.

The `ao_chans` member of `struct pci230_board` indicates whether the
board has an AO subdevice and the number of AO channels.  The
`ao_bits` member indicates the AO sample width in bits and will only be
non-zero for boards with an AO subdevice.

Use `ao_bits` to indicate whether the board has an AO subdevice.  If it
has, assume the the number of AO channels is 2.  Then the `ao_chans`
member becomes redundant and can be removed.

Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
 drivers/staging/comedi/drivers/amplc_pci230.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
index 42a79d2..75b0e79 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -455,7 +455,6 @@ struct pci230_board {
 	const char *name;
 	unsigned short id;
 	int ai_bits;
-	int ao_chans;
 	int ao_bits;
 	int have_dio;
 	unsigned int min_hwver;	/* Minimum hardware version supported. */
@@ -466,7 +465,6 @@ static const struct pci230_board pci230_boards[] = {
 		.name		= "pci230+",
 		.id		= PCI_DEVICE_ID_PCI230,
 		.ai_bits	= 16,
-		.ao_chans	= 2,
 		.ao_bits	= 12,
 		.have_dio	= 1,
 		.min_hwver	= 1,
@@ -481,7 +479,6 @@ static const struct pci230_board pci230_boards[] = {
 		.name		= "pci230",
 		.id		= PCI_DEVICE_ID_PCI230,
 		.ai_bits	= 12,
-		.ao_chans	= 2,
 		.ao_bits	= 12,
 		.have_dio	= 1,
 	},
@@ -2609,7 +2606,7 @@ static int pci230_auto_attach(struct comedi_device *dev,
 				 */
 				extfunc |= PCI230P_EXTFUNC_GAT_EXTTRIG;
 			}
-			if (thisboard->ao_chans > 0 && devpriv->hwver >= 2) {
+			if (thisboard->ao_bits && devpriv->hwver >= 2) {
 				/* Enable DAC FIFO functionality. */
 				extfunc |= PCI230P2_EXTFUNC_DACFIFO;
 			}
@@ -2670,15 +2667,15 @@ static int pci230_auto_attach(struct comedi_device *dev,
 
 	s = &dev->subdevices[1];
 	/* analog output subdevice */
-	if (thisboard->ao_chans > 0) {
+	if (thisboard->ao_bits) {
 		s->type = COMEDI_SUBD_AO;
 		s->subdev_flags = SDF_WRITABLE | SDF_GROUND;
-		s->n_chan = thisboard->ao_chans;
+		s->n_chan = 2;
 		s->maxdata = (1 << thisboard->ao_bits) - 1;
 		s->range_table = &pci230_ao_range;
 		s->insn_write = pci230_ao_insn_write;
 		s->insn_read = comedi_readback_insn_read;
-		s->len_chanlist = thisboard->ao_chans;
+		s->len_chanlist = 2;
 		if (dev->irq) {
 			dev->write_subdev = s;
 			s->subdev_flags |= SDF_CMD_WRITE;
-- 
2.0.4

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ