Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363393
b: refs/heads/master
c: 97bcce5
h: refs/heads/master
i:
  363391: cc3ec27
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent 8c2dae2 commit 6436e9b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 39 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: e4f0e1302908488fd2761a76d2d8cbddc1d291a7
refs/heads/master: 97bcce5a4cf420986670c43923aa4bc5efa9bc2e
63 changes: 25 additions & 38 deletions trunk/drivers/staging/comedi/drivers/ni_660x.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,31 +389,32 @@ enum global_interrupt_config_register_bits {
/* First chip is at base-address + 0x00, etc. */
static const unsigned GPCT_OFFSET[2] = { 0x0, 0x800 };

/* Board description*/
enum ni_660x_boardid {
BOARD_PCI6601,
BOARD_PCI6602,
BOARD_PXI6602,
BOARD_PXI6608,
};

struct ni_660x_board {
unsigned short dev_id; /* `lspci` will show you this */
const char *name;
unsigned n_chips; /* total number of TIO chips */
};

static const struct ni_660x_board ni_660x_boards[] = {
{
.dev_id = 0x2c60,
[BOARD_PCI6601] = {
.name = "PCI-6601",
.n_chips = 1,
},
{
.dev_id = 0x1310,
[BOARD_PCI6602] = {
.name = "PCI-6602",
.n_chips = 2,
},
{
.dev_id = 0x1360,
[BOARD_PXI6602] = {
.name = "PXI-6602",
.n_chips = 2,
},
{
.dev_id = 0x2cc0,
[BOARD_PXI6608] = {
.name = "PXI-6608",
.n_chips = 2,
},
Expand Down Expand Up @@ -974,20 +975,6 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev)
}
}

static const struct ni_660x_board *
ni_660x_find_boardinfo(struct pci_dev *pcidev)
{
unsigned int dev_id = pcidev->device;
unsigned int n;

for (n = 0; n < ARRAY_SIZE(ni_660x_boards); n++) {
const struct ni_660x_board *board = &ni_660x_boards[n];
if (board->dev_id == dev_id)
return board;
}
return NULL;
}

static int
ni_660x_GPCT_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
Expand Down Expand Up @@ -1170,32 +1157,32 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev,
}

static int ni_660x_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
unsigned long context)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct ni_660x_board *board;
const struct ni_660x_board *board = NULL;
struct ni_660x_private *devpriv;
struct comedi_subdevice *s;
int ret;
unsigned i;
unsigned global_interrupt_config_bits;

if (context < ARRAY_SIZE(ni_660x_boards))
board = &ni_660x_boards[context];
if (!board)
return -ENODEV;
dev->board_ptr = board;
dev->board_name = board->name;

ret = ni_660x_allocate_private(dev);
if (ret < 0)
return ret;
devpriv = dev->private;

dev->board_ptr = ni_660x_find_boardinfo(pcidev);
if (!dev->board_ptr)
return -ENODEV;
board = comedi_board(dev);

devpriv->mite = mite_alloc(pcidev);
if (!devpriv->mite)
return -ENOMEM;

dev->board_name = board->name;

ret = mite_setup2(devpriv->mite, 1);
if (ret < 0) {
dev_warn(dev->class_dev, "error setting up mite\n");
Expand Down Expand Up @@ -1331,11 +1318,11 @@ static int ni_660x_pci_probe(struct pci_dev *dev,
}

static DEFINE_PCI_DEVICE_TABLE(ni_660x_pci_table) = {
{PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c60)},
{PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1310)},
{PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1360)},
{PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2cc0)},
{0}
{ PCI_VDEVICE(NI, 0x1310), BOARD_PCI6602 },
{ PCI_VDEVICE(NI, 0x1360), BOARD_PXI6602 },
{ PCI_VDEVICE(NI, 0x2c60), BOARD_PCI6601 },
{ PCI_VDEVICE(NI, 0x2cc0), BOARD_PXI6608 },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, ni_660x_pci_table);

Expand Down

0 comments on commit 6436e9b

Please sign in to comment.