Commit 9f2dbefb authored by Chase Southwood's avatar Chase Southwood Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_1564: don't allocate unused subdevices

The addi-data common code always allocates 7 subdevices.  This driver
cannot or will not use the ones we are currently allocating for analog
input and output or EEPROM, so just don't allocate these subdevices at
all.
Signed-off-by: default avatarChase Southwood <chase.southwood@gmail.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 33ae8a5e
...@@ -47,7 +47,7 @@ static int apci1564_auto_attach(struct comedi_device *dev, ...@@ -47,7 +47,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
const struct addi_board *this_board = comedi_board(dev); const struct addi_board *this_board = comedi_board(dev);
struct addi_private *devpriv; struct addi_private *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret, n_subdevices; int ret;
dev->board_name = this_board->pc_DriverName; dev->board_name = this_board->pc_DriverName;
...@@ -69,21 +69,12 @@ static int apci1564_auto_attach(struct comedi_device *dev, ...@@ -69,21 +69,12 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->irq = pcidev->irq; dev->irq = pcidev->irq;
} }
n_subdevices = 7; ret = comedi_alloc_subdevices(dev, 3);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret) if (ret)
return ret; return ret;
/* Allocate and Initialise AI Subdevice Structures */
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_UNUSED;
/* Allocate and Initialise AO Subdevice Structures */
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_UNUSED;
/* Allocate and Initialise DI Subdevice Structures */ /* Allocate and Initialise DI Subdevice Structures */
s = &dev->subdevices[2]; s = &dev->subdevices[0];
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
s->n_chan = 32; s->n_chan = 32;
...@@ -94,7 +85,7 @@ static int apci1564_auto_attach(struct comedi_device *dev, ...@@ -94,7 +85,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->insn_bits = apci1564_di_insn_bits; s->insn_bits = apci1564_di_insn_bits;
/* Allocate and Initialise DO Subdevice Structures */ /* Allocate and Initialise DO Subdevice Structures */
s = &dev->subdevices[3]; s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITEABLE; s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 32; s->n_chan = 32;
...@@ -106,7 +97,7 @@ static int apci1564_auto_attach(struct comedi_device *dev, ...@@ -106,7 +97,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->insn_read = apci1564_do_read; s->insn_read = apci1564_do_read;
/* Allocate and Initialise Timer Subdevice Structures */ /* Allocate and Initialise Timer Subdevice Structures */
s = &dev->subdevices[4]; s = &dev->subdevices[2];
if (this_board->i_Timer) { if (this_board->i_Timer) {
s->type = COMEDI_SUBD_TIMER; s->type = COMEDI_SUBD_TIMER;
s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
...@@ -123,14 +114,6 @@ static int apci1564_auto_attach(struct comedi_device *dev, ...@@ -123,14 +114,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
/* Allocate and Initialise TTL */
s = &dev->subdevices[5];
s->type = COMEDI_SUBD_UNUSED;
/* EEPROM */
s = &dev->subdevices[6];
s->type = COMEDI_SUBD_UNUSED;
i_ADDI_Reset(dev); i_ADDI_Reset(dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment