Commit 449b683c authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: remove this_board macro in the pcmad driver

The 'this_board' macro depends on having a local variable with
a magic name. The CodingStyle document suggests not doing this
to avoid confusion. Remove the macro and use the comedi_board()
inline helper to get the dev->board_ptr information.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2fbffee0
...@@ -58,8 +58,6 @@ struct pcmad_board_struct { ...@@ -58,8 +58,6 @@ struct pcmad_board_struct {
int n_ai_bits; int n_ai_bits;
}; };
#define this_board ((const struct pcmad_board_struct *)(dev->board_ptr))
struct pcmad_priv_struct { struct pcmad_priv_struct {
int differential; int differential;
int twos_comp; int twos_comp;
...@@ -72,6 +70,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, ...@@ -72,6 +70,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
const struct pcmad_board_struct *board = comedi_board(dev);
int i; int i;
int chan; int chan;
int n; int n;
...@@ -89,7 +88,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, ...@@ -89,7 +88,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev,
data[n] |= (inb(dev->iobase + PCMAD_MSB) << 8); data[n] |= (inb(dev->iobase + PCMAD_MSB) << 8);
if (devpriv->twos_comp) if (devpriv->twos_comp)
data[n] ^= (1 << (this_board->n_ai_bits - 1)); data[n] ^= (1 << (board->n_ai_bits - 1));
} }
return n; return n;
...@@ -104,6 +103,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, ...@@ -104,6 +103,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev,
*/ */
static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
const struct pcmad_board_struct *board = comedi_board(dev);
int ret; int ret;
struct comedi_subdevice *s; struct comedi_subdevice *s;
unsigned long iobase; unsigned long iobase;
...@@ -125,7 +125,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -125,7 +125,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0) if (ret < 0)
return ret; return ret;
dev->board_name = this_board->name; dev->board_name = board->name;
s = dev->subdevices + 0; s = dev->subdevices + 0;
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
...@@ -133,7 +133,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -133,7 +133,7 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->n_chan = 16; /* XXX */ s->n_chan = 16; /* XXX */
s->len_chanlist = 1; s->len_chanlist = 1;
s->insn_read = pcmad_ai_insn_read; s->insn_read = pcmad_ai_insn_read;
s->maxdata = (1 << this_board->n_ai_bits) - 1; s->maxdata = (1 << board->n_ai_bits) - 1;
s->range_table = &range_unknown; s->range_table = &range_unknown;
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