Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304724
b: refs/heads/master
c: 0d09df0
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed May 16, 2012
1 parent 56c481b commit 939d3c3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 94 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: c57630673b84a2e0563ea63117062b1ab51f4bbf
refs/heads/master: 0d09df00279fde45535819e1cace3e9d330137e3
131 changes: 38 additions & 93 deletions trunk/drivers/staging/comedi/drivers/amplc_pci224.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,6 @@ static const struct pci224_board pci224_boards[] = {
},
};

/*
* PCI driver table.
*/

static DEFINE_PCI_DEVICE_TABLE(pci224_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) },
{0}
};

MODULE_DEVICE_TABLE(pci, pci224_pci_table);

/*
* Useful for shorthand access to the particular board structure
*/
Expand Down Expand Up @@ -421,68 +409,6 @@ struct pci224_private {

#define devpriv ((struct pci224_private *)dev->private)

/*
* The struct comedi_driver structure tells the Comedi core module
* which functions to call to configure/deconfigure (attach/detach)
* the board, and also about the kernel module that contains
* the device code.
*/
static int pci224_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int pci224_detach(struct comedi_device *dev);
static int pci224_attach_pci(struct comedi_device *dev,
struct pci_dev *pci_dev);
static struct comedi_driver driver_amplc_pci224 = {
.driver_name = DRIVER_NAME,
.module = THIS_MODULE,
.attach = pci224_attach,
.detach = pci224_detach,
.attach_pci = pci224_attach_pci,
.board_name = &pci224_boards[0].name,
.offset = sizeof(struct pci224_board),
.num_names = ARRAY_SIZE(pci224_boards),
};

static int __devinit driver_amplc_pci224_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, &driver_amplc_pci224);
}

static void __devexit driver_amplc_pci224_pci_remove(struct pci_dev *dev)
{
comedi_pci_auto_unconfig(dev);
}

static struct pci_driver driver_amplc_pci224_pci_driver = {
.id_table = pci224_pci_table,
.probe = &driver_amplc_pci224_pci_probe,
.remove = __devexit_p(&driver_amplc_pci224_pci_remove)
};

static int __init driver_amplc_pci224_init_module(void)
{
int retval;

retval = comedi_driver_register(&driver_amplc_pci224);
if (retval < 0)
return retval;

driver_amplc_pci224_pci_driver.name =
(char *)driver_amplc_pci224.driver_name;
return pci_register_driver(&driver_amplc_pci224_pci_driver);
}

static void __exit driver_amplc_pci224_cleanup_module(void)
{
pci_unregister_driver(&driver_amplc_pci224_pci_driver);
comedi_driver_unregister(&driver_amplc_pci224);
}

module_init(driver_amplc_pci224_init_module);
module_exit(driver_amplc_pci224_cleanup_module);

/*
* Called from the 'insn_write' function to perform a single write.
*/
Expand Down Expand Up @@ -1547,12 +1473,6 @@ static int pci224_attach_common(struct comedi_device *dev,
return 1;
}

/*
* _attach is called by the Comedi core to configure the driver
* for a particular board. If you specified a board_name array
* in the driver structure, dev->board_ptr contains that
* address.
*/
static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
struct pci_dev *pci_dev;
Expand All @@ -1577,11 +1497,6 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return pci224_attach_common(dev, pci_dev, it->options);
}

/*
* _attach_pci is called by comedi_pci_auto_config() in the Comedi core
* to configure a comedi device for a probed PCI device.
* dev->board_ptr is NULL on entry.
*/
static int
pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
{
Expand All @@ -1607,14 +1522,6 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
return pci224_attach_common(dev, pci_dev, NULL);
}

/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int pci224_detach(struct comedi_device *dev)
{
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME);
Expand Down Expand Up @@ -1648,6 +1555,44 @@ static int pci224_detach(struct comedi_device *dev)
return 0;
}

static struct comedi_driver amplc_pci224_driver = {
.driver_name = "amplc_pci224",
.module = THIS_MODULE,
.attach = pci224_attach,
.detach = pci224_detach,
.attach_pci = pci224_attach_pci,
.board_name = &pci224_boards[0].name,
.offset = sizeof(struct pci224_board),
.num_names = ARRAY_SIZE(pci224_boards),
};

static int __devinit amplc_pci224_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, &amplc_pci224_driver);
}

static void __devexit amplc_pci224_pci_remove(struct pci_dev *dev)
{
comedi_pci_auto_unconfig(dev);
}

static DEFINE_PCI_DEVICE_TABLE(amplc_pci224_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, amplc_pci224_pci_table);

static struct pci_driver amplc_pci224_pci_driver = {
.name = "amplc_pci224",
.id_table = amplc_pci224_pci_table,
.probe = amplc_pci224_pci_probe,
.remove = __devexit_p(amplc_pci224_pci_remove),
};
module_comedi_pci_driver(amplc_pci224_driver, amplc_pci224_pci_driver);

MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver");
MODULE_LICENSE("GPL");

0 comments on commit 939d3c3

Please sign in to comment.