summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcmda12.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/comedi/drivers/pcmda12.c')
-rw-r--r--drivers/staging/comedi/drivers/pcmda12.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c
index 4786148b4fd0..291ce7c1bdb1 100644
--- a/drivers/staging/comedi/drivers/pcmda12.c
+++ b/drivers/staging/comedi/drivers/pcmda12.c
@@ -80,11 +80,6 @@ static const struct comedi_lrange pcmda12_ranges = {
}
};
-/*
- * Useful for shorthand access to the particular board structure
- */
-#define thisboard ((const struct pcmda12_board *)dev->board_ptr)
-
struct pcmda12_private {
unsigned int ao_readback[CHANS];
@@ -167,8 +162,10 @@ static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
static int pcmda12_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
+ const struct pcmda12_board *board = comedi_board(dev);
struct comedi_subdevice *s;
unsigned long iobase;
+ int ret;
iobase = it->options[0];
printk(KERN_INFO
@@ -181,11 +178,7 @@ static int pcmda12_attach(struct comedi_device *dev,
}
dev->iobase = iobase;
-/*
- * Initialize dev->board_name. Note that we can use the "thisboard"
- * macro now, since we just initialized it in the last line.
- */
- dev->board_name = thisboard->name;
+ dev->board_name = board->name;
/*
* Allocate the private structure area. alloc_private() is a
@@ -198,17 +191,9 @@ static int pcmda12_attach(struct comedi_device *dev,
devpriv->simultaneous_xfer_mode = it->options[1];
- /*
- * Allocate the subdevice structures. alloc_subdevice() is a
- * convenient macro defined in comedidev.h.
- *
- * Allocate 2 subdevs (32 + 16 DIO lines) or 3 32 DIO subdevs for the
- * 96-channel version of the board.
- */
- if (alloc_subdevices(dev, 1) < 0) {
- printk(KERN_ERR "cannot allocate subdevice data structures\n");
- return -ENOMEM;
- }
+ ret = comedi_alloc_subdevices(dev, 1);
+ if (ret)
+ return ret;
s = dev->subdevices;
s->private = NULL;