.dabits = 12},
};
-#define boardtype (*(const struct dt2801_board *)dev->board_ptr)
-
struct dt2801_private {
const struct comedi_lrange *dac_range_types[2];
*/
static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
+ const struct dt2801_board *board = comedi_board(dev);
struct dt2801_private *devpriv;
struct comedi_subdevice *s;
unsigned long iobase;
havetype:
dev->board_ptr = boardtypes + type;
- printk("dt2801: %s at port 0x%lx", boardtype.name, iobase);
+ board = comedi_board(dev);
+ printk("dt2801: %s at port 0x%lx", board->name, iobase);
n_ai_chans = probe_number_of_ai_chans(dev);
printk(" (ai channels = %d)\n", n_ai_chans);
return -ENOMEM;
dev->private = devpriv;
- dev->board_name = boardtype.name;
+ dev->board_name = board->name;
s = &dev->subdevices[0];
/* ai subdevice */
s->n_chan = n_ai_chans;
#else
if (it->options[2])
- s->n_chan = boardtype.ad_chan;
+ s->n_chan = board->ad_chan;
else
- s->n_chan = boardtype.ad_chan / 2;
+ s->n_chan = board->ad_chan / 2;
#endif
- s->maxdata = (1 << boardtype.adbits) - 1;
- s->range_table = ai_range_lkup(boardtype.adrangetype, it->options[3]);
+ s->maxdata = (1 << board->adbits) - 1;
+ s->range_table = ai_range_lkup(board->adrangetype, it->options[3]);
s->insn_read = dt2801_ai_insn_read;
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE;
s->n_chan = 2;
- s->maxdata = (1 << boardtype.dabits) - 1;
+ s->maxdata = (1 << board->dabits) - 1;
s->range_table_list = devpriv->dac_range_types;
devpriv->dac_range_types[0] = dac_range_lkup(it->options[4]);
devpriv->dac_range_types[1] = dac_range_lkup(it->options[5]);