Commit 3cff0f12 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: remove this_board macro in the pcm3724 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 449b683c
...@@ -76,10 +76,6 @@ struct priv_pcm3724 { ...@@ -76,10 +76,6 @@ struct priv_pcm3724 {
int dio_2; int dio_2;
}; };
#define this_board ((const struct pcm3724_board *)dev->board_ptr)
/* (setq c-basic-offset 8) */
static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) static int subdev_8255_cb(int dir, int port, int data, unsigned long arg)
{ {
unsigned long iobase = arg; unsigned long iobase = arg;
...@@ -234,12 +230,13 @@ static int subdev_3724_insn_config(struct comedi_device *dev, ...@@ -234,12 +230,13 @@ static int subdev_3724_insn_config(struct comedi_device *dev,
static int pcm3724_attach(struct comedi_device *dev, static int pcm3724_attach(struct comedi_device *dev,
struct comedi_devconfig *it) struct comedi_devconfig *it)
{ {
const struct pcm3724_board *board = comedi_board(dev);
unsigned long iobase; unsigned long iobase;
unsigned int iorange; unsigned int iorange;
int ret, i, n_subdevices; int ret, i, n_subdevices;
iobase = it->options[0]; iobase = it->options[0];
iorange = this_board->io_range; iorange = board->io_range;
ret = alloc_private(dev, sizeof(struct priv_pcm3724)); ret = alloc_private(dev, sizeof(struct priv_pcm3724));
if (ret < 0) if (ret < 0)
...@@ -249,17 +246,17 @@ static int pcm3724_attach(struct comedi_device *dev, ...@@ -249,17 +246,17 @@ static int pcm3724_attach(struct comedi_device *dev,
((struct priv_pcm3724 *)(dev->private))->dio_2 = 0; ((struct priv_pcm3724 *)(dev->private))->dio_2 = 0;
printk(KERN_INFO "comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor, printk(KERN_INFO "comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor,
this_board->name, iobase); board->name, iobase);
if (!iobase || !request_region(iobase, iorange, "pcm3724")) { if (!iobase || !request_region(iobase, iorange, "pcm3724")) {
printk("I/O port conflict\n"); printk("I/O port conflict\n");
return -EIO; return -EIO;
} }
dev->iobase = iobase; dev->iobase = iobase;
dev->board_name = this_board->name; dev->board_name = board->name;
printk(KERN_INFO "\n"); printk(KERN_INFO "\n");
n_subdevices = this_board->numofports; n_subdevices = board->numofports;
ret = alloc_subdevices(dev, n_subdevices); ret = alloc_subdevices(dev, n_subdevices);
if (ret < 0) if (ret < 0)
...@@ -275,6 +272,7 @@ static int pcm3724_attach(struct comedi_device *dev, ...@@ -275,6 +272,7 @@ static int pcm3724_attach(struct comedi_device *dev,
static void pcm3724_detach(struct comedi_device *dev) static void pcm3724_detach(struct comedi_device *dev)
{ {
const struct pcm3724_board *board = comedi_board(dev);
int i; int i;
if (dev->subdevices) { if (dev->subdevices) {
...@@ -282,7 +280,7 @@ static void pcm3724_detach(struct comedi_device *dev) ...@@ -282,7 +280,7 @@ static void pcm3724_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, dev->subdevices + i); subdev_8255_cleanup(dev, dev->subdevices + i);
} }
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, this_board->io_range); release_region(dev->iobase, board->io_range);
} }
static const struct pcm3724_board boardtypes[] = { static const struct pcm3724_board boardtypes[] = {
......
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