Commit 90d662e3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: remove this_board macro in the pcl711 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 f21b15be
...@@ -148,8 +148,6 @@ struct pcl711_board { ...@@ -148,8 +148,6 @@ struct pcl711_board {
const struct comedi_lrange *ai_range_type; const struct comedi_lrange *ai_range_type;
}; };
#define this_board ((const struct pcl711_board *)dev->board_ptr)
struct pcl711_private { struct pcl711_private {
int board; int board;
...@@ -169,6 +167,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) ...@@ -169,6 +167,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
int lo, hi; int lo, hi;
int data; int data;
struct comedi_device *dev = d; struct comedi_device *dev = d;
const struct pcl711_board *board = comedi_board(dev);
struct comedi_subdevice *s = dev->subdevices + 0; struct comedi_subdevice *s = dev->subdevices + 0;
if (!dev->attached) { if (!dev->attached) {
...@@ -184,7 +183,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) ...@@ -184,7 +183,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
/* FIXME! Nothing else sets ntrig! */ /* FIXME! Nothing else sets ntrig! */
if (!(--devpriv->ntrig)) { if (!(--devpriv->ntrig)) {
if (this_board->is_8112) if (board->is_8112)
outb(1, dev->iobase + PCL711_MODE); outb(1, dev->iobase + PCL711_MODE);
else else
outb(0, dev->iobase + PCL711_MODE); outb(0, dev->iobase + PCL711_MODE);
...@@ -197,13 +196,14 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) ...@@ -197,13 +196,14 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
static void pcl711_set_changain(struct comedi_device *dev, int chan) static void pcl711_set_changain(struct comedi_device *dev, int chan)
{ {
const struct pcl711_board *board = comedi_board(dev);
int chan_register; int chan_register;
outb(CR_RANGE(chan), dev->iobase + PCL711_GAIN); outb(CR_RANGE(chan), dev->iobase + PCL711_GAIN);
chan_register = CR_CHAN(chan); chan_register = CR_CHAN(chan);
if (this_board->is_8112) { if (board->is_8112) {
/* /*
* Set the correct channel. The two channel banks are switched * Set the correct channel. The two channel banks are switched
...@@ -225,6 +225,7 @@ static void pcl711_set_changain(struct comedi_device *dev, int chan) ...@@ -225,6 +225,7 @@ static void pcl711_set_changain(struct comedi_device *dev, int chan)
static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
const struct pcl711_board *board = comedi_board(dev);
int i, n; int i, n;
int hi, lo; int hi, lo;
...@@ -237,7 +238,7 @@ static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -237,7 +238,7 @@ static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s,
*/ */
outb(1, dev->iobase + PCL711_MODE); outb(1, dev->iobase + PCL711_MODE);
if (!this_board->is_8112) if (!board->is_8112)
outb(0, dev->iobase + PCL711_SOFTTRIG); outb(0, dev->iobase + PCL711_SOFTTRIG);
i = PCL711_TIMEOUT; i = PCL711_TIMEOUT;
...@@ -481,6 +482,7 @@ static int pcl711_do_insn_bits(struct comedi_device *dev, ...@@ -481,6 +482,7 @@ static int pcl711_do_insn_bits(struct comedi_device *dev,
static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
const struct pcl711_board *board = comedi_board(dev);
int ret; int ret;
unsigned long iobase; unsigned long iobase;
unsigned int irq; unsigned int irq;
...@@ -498,12 +500,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -498,12 +500,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* there should be a sanity check here */ /* there should be a sanity check here */
/* set up some name stuff */ dev->board_name = board->name;
dev->board_name = this_board->name;
/* grab our IRQ */ /* grab our IRQ */
irq = it->options[1]; irq = it->options[1];
if (irq > this_board->maxirq) { if (irq > board->maxirq) {
printk(KERN_ERR "irq out of range\n"); printk(KERN_ERR "irq out of range\n");
return -EINVAL; return -EINVAL;
} }
...@@ -529,10 +530,10 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -529,10 +530,10 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* AI subdevice */ /* AI subdevice */
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND; s->subdev_flags = SDF_READABLE | SDF_GROUND;
s->n_chan = this_board->n_aichan; s->n_chan = board->n_aichan;
s->maxdata = 0xfff; s->maxdata = 0xfff;
s->len_chanlist = 1; s->len_chanlist = 1;
s->range_table = this_board->ai_range_type; s->range_table = board->ai_range_type;
s->insn_read = pcl711_ai_insn; s->insn_read = pcl711_ai_insn;
if (irq) { if (irq) {
dev->read_subdev = s; dev->read_subdev = s;
...@@ -545,7 +546,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -545,7 +546,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* AO subdevice */ /* AO subdevice */
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
s->n_chan = this_board->n_aochan; s->n_chan = board->n_aochan;
s->maxdata = 0xfff; s->maxdata = 0xfff;
s->len_chanlist = 1; s->len_chanlist = 1;
s->range_table = &range_bipolar5; s->range_table = &range_bipolar5;
...@@ -577,7 +578,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -577,7 +578,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
this is the "base value" for the mode register, which is this is the "base value" for the mode register, which is
used for the irq on the PCL711 used for the irq on the PCL711
*/ */
if (this_board->is_pcl711b) if (board->is_pcl711b)
devpriv->mode = (dev->irq << 4); devpriv->mode = (dev->irq << 4);
/* clear DAC */ /* clear DAC */
......
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