Commit 678e4e27 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_1710: cleanup addi_find_boardinfo()

This driver uses the comedi PCI auto attach mechanism and the comedi
core does not use the boardinfo during the attach.

Now that this driver has the attach separated from addi_common.c we
can remove passing the boardinfo in the comedi_driver and cleanup
the code that finds the boardinfo.

Also, rename addi_find_boardinfo() so it has namespace associated
with this driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9ab760d
...@@ -54,19 +54,17 @@ static int i_ADDI_Reset(struct comedi_device *dev) ...@@ -54,19 +54,17 @@ static int i_ADDI_Reset(struct comedi_device *dev)
return 0; return 0;
} }
static const void *addi_find_boardinfo(struct comedi_device *dev, static const void *apci1710_find_boardinfo(struct comedi_device *dev,
struct pci_dev *pcidev) struct pci_dev *pcidev)
{ {
const void *p = dev->driver->board_name;
const struct addi_board *this_board; const struct addi_board *this_board;
int i; int i;
for (i = 0; i < dev->driver->num_names; i++) { for (i = 0; i < ARRAY_SIZE(apci1710_boardtypes); i++) {
this_board = p; this_board = &apci1710_boardtypes[i];
if (this_board->i_VendorId == pcidev->vendor && if (this_board->i_VendorId == pcidev->vendor &&
this_board->i_DeviceId == pcidev->device) this_board->i_DeviceId == pcidev->device)
return this_board; return this_board;
p += dev->driver->offset;
} }
return NULL; return NULL;
} }
...@@ -80,7 +78,7 @@ static int apci1710_attach_pci(struct comedi_device *dev, ...@@ -80,7 +78,7 @@ static int apci1710_attach_pci(struct comedi_device *dev,
int ret, pages, i, n_subdevices; int ret, pages, i, n_subdevices;
unsigned int dw_Dummy; unsigned int dw_Dummy;
this_board = addi_find_boardinfo(dev, pcidev); this_board = apci1710_find_boardinfo(dev, pcidev);
if (!this_board) if (!this_board)
return -ENODEV; return -ENODEV;
dev->board_ptr = this_board; dev->board_ptr = this_board;
...@@ -236,9 +234,6 @@ static struct comedi_driver apci1710_driver = { ...@@ -236,9 +234,6 @@ static struct comedi_driver apci1710_driver = {
.module = THIS_MODULE, .module = THIS_MODULE,
.attach_pci = apci1710_attach_pci, .attach_pci = apci1710_attach_pci,
.detach = apci1710_detach, .detach = apci1710_detach,
.num_names = ARRAY_SIZE(apci1710_boardtypes),
.board_name = &apci1710_boardtypes[0].pc_DriverName,
.offset = sizeof(struct addi_board),
}; };
static int __devinit apci1710_pci_probe(struct pci_dev *dev, static int __devinit apci1710_pci_probe(struct pci_dev *dev,
......
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