Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318064
b: refs/heads/master
c: 54b303c
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent 2f75be9 commit ab376cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 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: ad37c85c44bd9b40028c2338c7e1a7e9be3dbd70
refs/heads/master: 54b303c45d43d5b4ca69de843fb2d1a7160578f9
48 changes: 29 additions & 19 deletions trunk/drivers/staging/comedi/drivers/adv_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,23 +1077,16 @@ static int CheckAndAllocCard(struct comedi_device *dev,
pci_priv = devpriv;
}

devpriv->pcidev = pcidev;

return 1;
}

static int pci_dio_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int ret, subdev, n_subdevices, i, j;
unsigned long iobase;
struct pci_dev *pcidev = NULL;


ret = alloc_private(dev, sizeof(struct pci_dio_private));
if (ret < 0)
return -ENOMEM;
unsigned long iobase;
int i;
int ret;

for_each_pci_dev(pcidev) {
/* loop through cards supported by this driver */
Expand Down Expand Up @@ -1123,20 +1116,37 @@ static int pci_dio_attach(struct comedi_device *dev,
if (!dev->board_ptr) {
dev_err(dev->class_dev,
"Error: Requested type of the card was not found!\n");
return -EIO;
return NULL;
}
iobase = pci_resource_start(devpriv->pcidev, this_board->main_pci_region);
dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
pcidev->bus->number, PCI_SLOT(pcidev->devfn),
PCI_FUNC(pcidev->devfn), iobase);
return pcidev;
}

if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
static int pci_dio_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int ret, subdev, n_subdevices, i, j;

ret = alloc_private(dev, sizeof(struct pci_dio_private));
if (ret < 0)
return -ENOMEM;

devpriv->pcidev = pci_dio_find_pci_dev(dev, it);
if (!devpriv->pcidev)
return -EIO;

if (comedi_pci_enable(devpriv->pcidev, dev->driver->driver_name)) {
dev_err(dev->class_dev,
"Error: Can't enable PCI device and request regions!\n");
return -EIO;
}
iobase = pci_resource_start(pcidev, this_board->main_pci_region);
dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
pcidev->bus->number, PCI_SLOT(pcidev->devfn),
PCI_FUNC(pcidev->devfn), iobase);

dev->iobase = iobase;
dev->iobase = pci_resource_start(devpriv->pcidev,
this_board->main_pci_region);
dev->board_name = this_board->name;

if (this_board->cardtype == TYPE_PCI1760) {
Expand Down

0 comments on commit ab376cb

Please sign in to comment.