Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324571
b: refs/heads/master
c: 6bfbd98
h: refs/heads/master
i:
  324569: 50ba756
  324567: 80acc09
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Aug 17, 2012
1 parent 85a67db commit b022442
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 53 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: 180d7fc8ab7ace9b911196d6eba2c1e47c3cbe85
refs/heads/master: 6bfbd988d8abfd86e0cd93ae21ba1998378bddfa
65 changes: 13 additions & 52 deletions trunk/drivers/staging/comedi/drivers/adl_pci8164.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ Author: Michel Lachaine <mike@mikelachaine.ca>
Status: experimental
Updated: Mon, 14 Apr 2008 15:10:32 +0100
Configuration Options:
[0] - PCI bus of device (optional)
[1] - PCI slot of device (optional)
If bus/slot is not specified, the first supported
PCI device found will be used.
Configuration Options: not applicable, uses PCI auto config
*/

#include "../comedidev.h"
Expand Down Expand Up @@ -216,59 +212,24 @@ static int adl_pci8164_insn_write_buf1(struct comedi_device *dev,
return 2;
}

static struct pci_dev *adl_pci8164_find_pci(struct comedi_device *dev,
struct comedi_devconfig *it)
static int adl_pci8164_attach_pci(struct comedi_device *dev,
struct pci_dev *pcidev)
{
struct pci_dev *pcidev = NULL;
int bus = it->options[0];
int slot = it->options[1];

for_each_pci_dev(pcidev) {
if (pcidev->vendor != PCI_VENDOR_ID_ADLINK ||
pcidev->device != PCI_DEVICE_ID_PCI8164)
continue;
if (bus || slot) {
/* requested particular bus/slot */
if (pcidev->bus->number != bus ||
PCI_SLOT(pcidev->devfn) != slot)
continue;
}
return pcidev;
}
printk(KERN_ERR
"comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
dev->minor, bus, slot);
return NULL;
}

static int adl_pci8164_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
struct comedi_subdevice *s;
int ret;

printk(KERN_INFO "comedi: attempt to attach...\n");
printk(KERN_INFO "comedi%d: adl_pci8164\n", dev->minor);
comedi_set_hw_dev(dev, &pcidev->dev);

dev->board_name = "pci8164";
dev->board_name = dev->driver->driver_name;

ret = comedi_alloc_subdevices(dev, 4);
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
return ret;

pcidev = adl_pci8164_find_pci(dev, it);
if (!pcidev)
return -EIO;
comedi_set_hw_dev(dev, &pcidev->dev);

if (comedi_pci_enable(pcidev, "adl_pci8164") < 0) {
printk(KERN_ERR "comedi%d: Failed to enable "
"PCI device and request regions\n", dev->minor);
return -EIO;
}
dev->iobase = pci_resource_start(pcidev, 2);
printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase);

ret = comedi_alloc_subdevices(dev, 4);
if (ret)
return ret;

s = dev->subdevices + 0;
s->type = COMEDI_SUBD_PROC;
Expand Down Expand Up @@ -310,7 +271,8 @@ static int adl_pci8164_attach(struct comedi_device *dev,
s->insn_read = adl_pci8164_insn_read_buf1;
s->insn_write = adl_pci8164_insn_write_buf1;

printk(KERN_INFO "comedi: attached\n");
dev_info(dev->class_dev, "%s attached\n", dev->board_name);

return 0;
}

Expand All @@ -321,14 +283,13 @@ static void adl_pci8164_detach(struct comedi_device *dev)
if (pcidev) {
if (dev->iobase)
comedi_pci_disable(pcidev);
pci_dev_put(pcidev);
}
}

static struct comedi_driver adl_pci8164_driver = {
.driver_name = "adl_pci8164",
.module = THIS_MODULE,
.attach = adl_pci8164_attach,
.attach_pci = adl_pci8164_attach_pci,
.detach = adl_pci8164_detach,
};

Expand Down

0 comments on commit b022442

Please sign in to comment.