Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318056
b: refs/heads/master
c: 05979c7
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent cc8c7fc commit ab79e15
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 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: c945a1d1189428101c357220ee25f6adc906a7de
refs/heads/master: 05979c7b3c5463eddbbfd3dd56f8a62679508c5e
42 changes: 26 additions & 16 deletions trunk/drivers/staging/comedi/drivers/adv_pci1723.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,29 +287,18 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev,
return insn->n;
}

static int pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int ret, subdev, n_subdevices;
struct pci_dev *pcidev;
unsigned int iobase;
unsigned char pci_bus, pci_slot, pci_func;
int opt_bus, opt_slot;
const char *errstr;

printk(KERN_ERR "comedi%d: adv_pci1723: board=%s",
dev->minor, this_board->name);

opt_bus = it->options[0];
opt_slot = it->options[1];

ret = alloc_private(dev, sizeof(struct pci1723_private));
if (ret < 0) {
printk(" - Allocation failed!\n");
return -ENOMEM;
}

/* Look for matching PCI device */
errstr = "not found!";
pcidev = NULL;
Expand Down Expand Up @@ -342,7 +331,7 @@ static int pci1723_attach(struct comedi_device *dev,
} else {
printk(KERN_ERR " - Card %s\n", errstr);
}
return -EIO;
return NULL;
}

pci_bus = pcidev->bus->number;
Expand All @@ -353,10 +342,31 @@ static int pci1723_attach(struct comedi_device *dev,
printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x",
pci_bus, pci_slot, pci_func, iobase);

dev->iobase = iobase;
return pcidev;
}

static int pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int ret, subdev, n_subdevices;

printk(KERN_ERR "comedi%d: adv_pci1723: board=%s",
dev->minor, this_board->name);

ret = alloc_private(dev, sizeof(struct pci1723_private));
if (ret < 0) {
printk(" - Allocation failed!\n");
return -ENOMEM;
}

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

dev->iobase = pci_resource_start(devpriv->pcidev, 2);

dev->board_name = this_board->name;
devpriv->pcidev = pcidev;

n_subdevices = 0;

Expand Down

0 comments on commit ab79e15

Please sign in to comment.