staging: comedi: adv_pci_dio: clarify subdevice index in pci1760_attach()
authorH Hartley Sweeten <hartleys@visionengravers.com>
Thu, 6 Sep 2012 01:28:00 +0000 (18:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Sep 2012 03:01:37 +0000 (20:01 -0700)
The subdevice index numbers are fixed when attaching to a pci1710 card.
Remove the subdev variable and just open code the array index numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adv_pci_dio.c

index fa5a6a16a0ab42b8602ada7fe752eec05cfb5c3e..9c9896d01cf121f94a6fccd40f013fa75226fc73 100644 (file)
@@ -955,9 +955,8 @@ static int pci_dio_reset(struct comedi_device *dev)
 static int pci1760_attach(struct comedi_device *dev)
 {
        struct comedi_subdevice *s;
-       int subdev = 0;
 
-       s = &dev->subdevices[subdev];
+       s = &dev->subdevices[0];
        s->type = COMEDI_SUBD_DI;
        s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
        s->n_chan = 8;
@@ -965,9 +964,8 @@ static int pci1760_attach(struct comedi_device *dev)
        s->len_chanlist = 8;
        s->range_table = &range_digital;
        s->insn_bits = pci1760_insn_bits_di;
-       subdev++;
 
-       s = &dev->subdevices[subdev];
+       s = &dev->subdevices[1];
        s->type = COMEDI_SUBD_DO;
        s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
        s->n_chan = 8;
@@ -976,18 +974,16 @@ static int pci1760_attach(struct comedi_device *dev)
        s->range_table = &range_digital;
        s->state = 0;
        s->insn_bits = pci1760_insn_bits_do;
-       subdev++;
 
-       s = &dev->subdevices[subdev];
+       s = &dev->subdevices[2];
        s->type = COMEDI_SUBD_TIMER;
        s->subdev_flags = SDF_WRITABLE | SDF_LSAMPL;
        s->n_chan = 2;
        s->maxdata = 0xffffffff;
        s->len_chanlist = 2;
 /*       s->insn_config=pci1760_insn_pwm_cfg; */
-       subdev++;
 
-       s = &dev->subdevices[subdev];
+       s = &dev->subdevices[3];
        s->type = COMEDI_SUBD_COUNTER;
        s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
        s->n_chan = 8;
@@ -996,7 +992,6 @@ static int pci1760_attach(struct comedi_device *dev)
        s->insn_read = pci1760_insn_cnt_read;
        s->insn_write = pci1760_insn_cnt_write;
 /*       s->insn_config=pci1760_insn_cnt_cfg; */
-       subdev++;
 
        return 0;
 }