[PATCH 06/33] staging: comedi: adv_pci_dio: absorb pci_dio_add_do()

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

 



This function initializes a digitial output subdevice. For aesthetics,
absorb it into the (*auto_attach).

Remove the improper initialization of the SDF_LSAMPL subdev_flag and
len_chanlist. These are only used by subdevices that support async
commands.

Also remove the unnecessary initilaization of the subdevice 'state'.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c
index 5da1e62..deac3a8 100644
--- a/drivers/staging/comedi/drivers/adv_pci_dio.c
+++ b/drivers/staging/comedi/drivers/adv_pci_dio.c
@@ -467,34 +467,6 @@ static int pci_dio_add_di(struct comedi_device *dev,
 	return 0;
 }
 
-static int pci_dio_add_do(struct comedi_device *dev,
-			  struct comedi_subdevice *s,
-			  const struct diosubd_data *d)
-{
-	const struct dio_boardtype *board = dev->board_ptr;
-
-	s->type = COMEDI_SUBD_DO;
-	s->subdev_flags = SDF_WRITABLE;
-	if (d->chans > 16)
-		s->subdev_flags |= SDF_LSAMPL;
-	s->n_chan = d->chans;
-	s->maxdata = 1;
-	s->len_chanlist = d->chans;
-	s->range_table = &range_digital;
-	s->state = 0;
-	switch (board->io_access) {
-	case IO_8b:
-		s->insn_bits = pci_dio_insn_bits_do_b;
-		break;
-	case IO_16b:
-		s->insn_bits = pci_dio_insn_bits_do_w;
-		break;
-	}
-	s->private = (void *)d;
-
-	return 0;
-}
-
 static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev,
 					       unsigned long cardtype)
 {
@@ -568,7 +540,20 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
 		d = &board->sdo[i];
 		if (d->chans) {
 			s = &dev->subdevices[subdev++];
-			pci_dio_add_do(dev, s, d);
+			s->type		= COMEDI_SUBD_DO;
+			s->subdev_flags	= SDF_WRITABLE;
+			s->n_chan	= d->chans;
+			s->maxdata	= 1;
+			s->range_table	= &range_digital;
+			switch (board->io_access) {
+			case IO_8b:
+				s->insn_bits	= pci_dio_insn_bits_do_b;
+				break;
+			case IO_16b:
+				s->insn_bits	= pci_dio_insn_bits_do_w;
+				break;
+			}
+			s->private	= (void *)d;
 		}
 	}
 
-- 
2.5.1

_______________________________________________
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