From 23e79f81ade338d1ca9283895088b5d0f57bc4df Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 5 Apr 2013 17:36:03 -0700 Subject: [PATCH] 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: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2801.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index f6942aaf0ecd..f5a55a6ac19b 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -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 @@ havetype: 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 @@ havetype: 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 @@ havetype: 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]); -- 2.39.5