Commit 30f23066 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_at_a2150: cleanup a2150_probe()

Make this function return a pointer to the boardinfo instead of an index.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6e2b126d
...@@ -687,12 +687,14 @@ static void a2150_free_dma(struct comedi_device *dev) ...@@ -687,12 +687,14 @@ static void a2150_free_dma(struct comedi_device *dev)
comedi_isadma_free(devpriv->dma); comedi_isadma_free(devpriv->dma);
} }
/* probes board type, returns offset */ static const struct a2150_board *a2150_probe(struct comedi_device *dev)
static int a2150_probe(struct comedi_device *dev)
{ {
int status = inw(dev->iobase + STATUS_REG); int id = ID_BITS(inw(dev->iobase + STATUS_REG));
return ID_BITS(status); if (id >= ARRAY_SIZE(a2150_boards))
return NULL;
return &a2150_boards[id];
} }
static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
...@@ -712,12 +714,10 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -712,12 +714,10 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret) if (ret)
return ret; return ret;
i = a2150_probe(dev); thisboard = a2150_probe(dev);
if (i >= ARRAY_SIZE(a2150_boards)) if (!thisboard)
return -ENODEV; return -ENODEV;
dev->board_ptr = thisboard;
dev->board_ptr = a2150_boards + i;
thisboard = dev->board_ptr;
dev->board_name = thisboard->name; dev->board_name = thisboard->name;
/* an IRQ and DMA are required to support async commands */ /* an IRQ and DMA are required to support async commands */
......
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