Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304703
b: refs/heads/master
c: 5aac829
h: refs/heads/master
i:
  304701: d4d6d8c
  304699: 3c86b6f
  304695: 88ad682
  304687: 944066c
  304671: 31114b4
  304639: f9ef611
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed May 16, 2012
1 parent d860d27 commit 93430ed
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 56 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: d22418b09d894af6a1458911dd61e245b4d1d820
refs/heads/master: 5aac8294de60cd2ffac3236c7052571ed6c2d56d
92 changes: 37 additions & 55 deletions trunk/drivers/staging/comedi/drivers/ni_atmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,49 +343,8 @@ static struct pnp_device_id device_ids[] = {

MODULE_DEVICE_TABLE(pnp, device_ids);

static int ni_atmio_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int ni_atmio_detach(struct comedi_device *dev);
static struct comedi_driver driver_atmio = {
.driver_name = "ni_atmio",
.module = THIS_MODULE,
.attach = ni_atmio_attach,
.detach = ni_atmio_detach,
};

static int __init driver_atmio_init_module(void)
{
return comedi_driver_register(&driver_atmio);
}

static void __exit driver_atmio_cleanup_module(void)
{
comedi_driver_unregister(&driver_atmio);
}

module_init(driver_atmio_init_module);
module_exit(driver_atmio_cleanup_module);

#include "ni_mio_common.c"

static int ni_getboardtype(struct comedi_device *dev);

/* clean up allocated resources */
static int ni_atmio_detach(struct comedi_device *dev)
{
mio_common_detach(dev);

if (dev->iobase)
release_region(dev->iobase, NI_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);

if (devpriv->isapnp_dev)
pnp_device_detach(devpriv->isapnp_dev);

return 0;
}

static int ni_isapnp_find_board(struct pnp_dev **dev)
{
struct pnp_dev *isapnp_dev = NULL;
Expand Down Expand Up @@ -424,6 +383,26 @@ static int ni_isapnp_find_board(struct pnp_dev **dev)
return 0;
}

static int ni_getboardtype(struct comedi_device *dev)
{
int device_id = ni_read_eeprom(dev, 511);
int i;

for (i = 0; i < n_ni_boards; i++) {
if (ni_boards[i].device_id == device_id)
return i;

}
if (device_id == 255)
printk(" can't find board\n");
else if (device_id == 0)
printk(" EEPROM read error (?) or device not found\n");
else
printk(" unknown device ID %d -- contact author\n", device_id);

return -1;
}

static int ni_atmio_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
Expand Down Expand Up @@ -518,22 +497,25 @@ static int ni_atmio_attach(struct comedi_device *dev,
return 0;
}

static int ni_getboardtype(struct comedi_device *dev)
static int ni_atmio_detach(struct comedi_device *dev)
{
int device_id = ni_read_eeprom(dev, 511);
int i;
mio_common_detach(dev);

for (i = 0; i < n_ni_boards; i++) {
if (ni_boards[i].device_id == device_id)
return i;
if (dev->iobase)
release_region(dev->iobase, NI_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);

}
if (device_id == 255)
printk(" can't find board\n");
else if (device_id == 0)
printk(" EEPROM read error (?) or device not found\n");
else
printk(" unknown device ID %d -- contact author\n", device_id);
if (devpriv->isapnp_dev)
pnp_device_detach(devpriv->isapnp_dev);

return -1;
return 0;
}

static struct comedi_driver ni_atmio_driver = {
.driver_name = "ni_atmio",
.module = THIS_MODULE,
.attach = ni_atmio_attach,
.detach = ni_atmio_detach,
};
module_comedi_driver(ni_atmio_driver);

0 comments on commit 93430ed

Please sign in to comment.