Commit 23e79f81 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: dt2801: remove 'boardtype' macro

The 'boardtype' macro relies on a local variable having a specific
name and yields a struct derived from that local variable.

Replace the macro with local variables and use the comedi_board()
helper to get the struct as a pointer. Use pointer access when
using the variable.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3cb65d4d
......@@ -225,8 +225,6 @@ static const struct dt2801_board boardtypes[] = {
.dabits = 12},
};
#define boardtype (*(const struct dt2801_board *)dev->board_ptr)
struct dt2801_private {
const struct comedi_lrange *dac_range_types[2];
......@@ -592,6 +590,7 @@ static int dt2801_dio_insn_config(struct comedi_device *dev,
*/
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;
......@@ -624,7 +623,8 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
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);
......@@ -638,7 +638,7 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -ENOMEM;
dev->private = devpriv;
dev->board_name = boardtype.name;
dev->board_name = board->name;
s = &dev->subdevices[0];
/* ai subdevice */
......@@ -648,12 +648,12 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
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];
......@@ -661,7 +661,7 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
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]);
......
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