summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-03-05 16:58:25 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-11 17:01:45 (GMT)
commit5e42525df0a7a1262069d433b1015d0cf2107cb1 (patch)
tree9b3f4c294fd96f6820694083d847b95dbff9d184
parent1df0e5b0ca97e2aeaa2be8241ea840f06b4dabfa (diff)
downloadlinux-fsl-qoriq-5e42525df0a7a1262069d433b1015d0cf2107cb1.tar.xz
staging: comedi: adl_pci6208: use the pci id_table 'driver_data'
Create an enum to the boardinfo and pass that enum in the pci_driver id_table as the driver_data. Change the macro used to fill in the device table from PCI_DEVICE() to PCI_VDEVICE(). This allows passing the enum as the next field. This allows removing the 'dev_id' data from the boardinfo as well the search function that was used to locate the boardinfo for the PCI device. Since the PCI device ids are now only used in the id_table, remove the defines and open code the device ids. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/adl_pci6208.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c
index b8f0efc..49f82f4 100644
--- a/drivers/staging/comedi/drivers/adl_pci6208.c
+++ b/drivers/staging/comedi/drivers/adl_pci6208.c
@@ -47,12 +47,6 @@ References:
#include "../comedidev.h"
/*
- * ADLINK PCI Device ID's supported by this driver
- */
-#define PCI_DEVICE_ID_PCI6208 0x6208
-#define PCI_DEVICE_ID_PCI6216 0x6216
-
-/*
* PCI-6208/6216-GL register map
*/
#define PCI6208_AO_CONTROL(x) (0x00 + (2 * (x)))
@@ -66,20 +60,23 @@ References:
#define PCI6208_MAX_AO_CHANNELS 16
+enum pci6208_boardid {
+ BOARD_PCI6208,
+ BOARD_PCI6216,
+};
+
struct pci6208_board {
const char *name;
- unsigned short dev_id;
int ao_chans;
};
static const struct pci6208_board pci6208_boards[] = {
- {
+ [BOARD_PCI6208] = {
.name = "adl_pci6208",
- .dev_id = PCI_DEVICE_ID_PCI6208,
.ao_chans = 8,
- }, {
+ },
+ [BOARD_PCI6216] = {
.name = "adl_pci6216",
- .dev_id = PCI_DEVICE_ID_PCI6216,
.ao_chans = 16,
},
};
@@ -162,31 +159,18 @@ static int pci6208_do_insn_bits(struct comedi_device *dev,
return insn->n;
}
-static const void *pci6208_find_boardinfo(struct comedi_device *dev,
- struct pci_dev *pcidev)
-{
- const struct pci6208_board *boardinfo;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) {
- boardinfo = &pci6208_boards[i];
- if (boardinfo->dev_id == pcidev->device)
- return boardinfo;
- }
- return NULL;
-}
-
static int pci6208_auto_attach(struct comedi_device *dev,
- unsigned long context_unused)
+ unsigned long context)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- const struct pci6208_board *boardinfo;
+ const struct pci6208_board *boardinfo = NULL;
struct pci6208_private *devpriv;
struct comedi_subdevice *s;
unsigned int val;
int ret;
- boardinfo = pci6208_find_boardinfo(dev, pcidev);
+ if (context < ARRAY_SIZE(pci6208_boards))
+ boardinfo = &pci6208_boards[context];
if (!boardinfo)
return -ENODEV;
dev->board_ptr = boardinfo;
@@ -274,8 +258,8 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev,
}
static DEFINE_PCI_DEVICE_TABLE(adl_pci6208_pci_table) = {
- { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI6208) },
- { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI6216) },
+ { PCI_VDEVICE(ADLINK, 0x6208), BOARD_PCI6208 },
+ { PCI_VDEVICE(ADLINK, 0x6216), BOARD_PCI6216 },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table);