Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324968
b: refs/heads/master
c: ba5cb4b
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent 5a0bc6d commit 126d4cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 37 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: f4c772f0c3d6477ab18af8bd8ac239049a1af6a5
refs/heads/master: ba5cb4ba57053153959587b67881eecec89eb08f
67 changes: 31 additions & 36 deletions trunk/drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,18 +1737,11 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
return 1;
}

static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
static struct pci_dev *me4000_probe(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct me4000_info *info;
struct pci_dev *pci_device = NULL;
int result, i;
const struct me4000_board *board;

/* Allocate private memory */
result = alloc_private(dev, sizeof(*info));
if (result)
return result;
info = dev->private;
int i;

/*
* Probe the device to determine what device in the series it is.
Expand Down Expand Up @@ -1777,39 +1770,55 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
}
}
dev->board_ptr = me4000_boards + i;
board = comedi_board(dev);
goto found;
return pci_device;
}
}
}
}
return -ENODEV;
return NULL;
}

static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
const struct me4000_board *thisboard;
struct me4000_info *info;
struct pci_dev *pcidev;
struct comedi_subdevice *s;
int result;

found:
comedi_set_hw_dev(dev, &pci_device->dev);
dev->board_name = board->name;
pcidev = me4000_probe(dev, it);
if (!pcidev)
return -ENODEV;
comedi_set_hw_dev(dev, &pcidev->dev);
thisboard = comedi_board(dev);
dev->board_name = thisboard->name;

result = comedi_pci_enable(pci_device, dev->board_name);
result = alloc_private(dev, sizeof(*info));
if (result)
return result;
info = dev->private;

info->plx_regbase = pci_resource_start(pci_device, 1);
result = comedi_pci_enable(pcidev, dev->board_name);
if (result)
return result;

info->plx_regbase = pci_resource_start(pcidev, 1);
if (!info->plx_regbase)
return -ENODEV;

dev->iobase = pci_resource_start(pci_device, 2);
dev->iobase = pci_resource_start(pcidev, 2);
if (!dev->iobase)
return -ENODEV;

info->timer_regbase = pci_resource_start(pci_device, 3);
info->timer_regbase = pci_resource_start(pcidev, 3);
if (!info->timer_regbase)
return -ENODEV;

info->program_regbase = pci_resource_start(pci_device, 5);
info->program_regbase = pci_resource_start(pcidev, 5);
if (!info->program_regbase)
return -ENODEV;

dev->irq = pci_device->irq;
dev->irq = pcidev->irq;

result = xilinx_download(dev);
if (result)
Expand All @@ -1819,20 +1828,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
if (result)
return result;

return 0;
}

static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
const struct me4000_board *thisboard;
struct comedi_subdevice *s;
int result;

result = me4000_probe(dev, it);
if (result)
return result;
thisboard = comedi_board(dev);

result = comedi_alloc_subdevices(dev, 4);
if (result)
return result;
Expand Down

0 comments on commit 126d4cf

Please sign in to comment.