Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363375
b: refs/heads/master
c: 5e42525
h: refs/heads/master
i:
  363373: 6db61a2
  363371: f6fb315
  363367: 0ede5f6
  363359: 5d98929
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent 1cd8fc8 commit b439860
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1df0e5b0ca97e2aeaa2be8241ea840f06b4dabfa
refs/heads/master: 5e42525df0a7a1262069d433b1015d0cf2107cb1
44 changes: 14 additions & 30 deletions trunk/drivers/staging/comedi/drivers/adl_pci6208.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ Configuration Options: not applicable, uses PCI auto config

#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
*/
Expand All @@ -66,20 +60,23 @@ Configuration Options: not applicable, uses PCI auto config

#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,
},
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b439860

Please sign in to comment.