Commit 3c4ba9e8 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: refactor adv_pci7123 driver to remove forward declarations

Move the struct comedi_driver variable and the associated
attach/detach routines to remove the need for the forward
declarations.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f97a28d
...@@ -150,34 +150,6 @@ static const struct pci1723_board boardtypes[] = { ...@@ -150,34 +150,6 @@ static const struct pci1723_board boardtypes[] = {
}, },
}; };
/*
* This is used by modprobe to translate PCI IDs to drivers.
* Should only be used for PCI and ISA-PnP devices
*/
static DEFINE_PCI_DEVICE_TABLE(pci1723_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1723) },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, pci1723_pci_table);
/*
* 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 pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int pci1723_detach(struct comedi_device *dev);
static struct comedi_driver driver_pci1723 = {
.driver_name = "adv_pci1723",
.module = THIS_MODULE,
.attach = pci1723_attach,
.detach = pci1723_detach,
};
/* This structure is for data unique to this hardware driver. */ /* This structure is for data unique to this hardware driver. */
struct pci1723_private { struct pci1723_private {
int valid; /* card is usable; */ int valid; /* card is usable; */
...@@ -317,10 +289,6 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev, ...@@ -317,10 +289,6 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev,
return 2; return 2;
} }
/*
* Attach is called by the Comedi core to configure the driver
* for a pci1723 board.
*/
static int pci1723_attach(struct comedi_device *dev, static int pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it) struct comedi_devconfig *it)
{ {
...@@ -463,14 +431,6 @@ static int pci1723_attach(struct comedi_device *dev, ...@@ -463,14 +431,6 @@ static int pci1723_attach(struct comedi_device *dev,
return 0; return 0;
} }
/*
* _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 pci1723_detach(struct comedi_device *dev) static int pci1723_detach(struct comedi_device *dev)
{ {
printk(KERN_ERR "comedi%d: pci1723: remove\n", dev->minor); printk(KERN_ERR "comedi%d: pci1723: remove\n", dev->minor);
...@@ -489,10 +449,13 @@ static int pci1723_detach(struct comedi_device *dev) ...@@ -489,10 +449,13 @@ static int pci1723_detach(struct comedi_device *dev)
return 0; return 0;
} }
/* static struct comedi_driver driver_pci1723 = {
* A convenient macro that defines init_module() and cleanup_module(), .driver_name = "adv_pci1723",
* as necessary. .module = THIS_MODULE,
*/ .attach = pci1723_attach,
.detach = pci1723_detach,
};
static int __devinit driver_pci1723_pci_probe(struct pci_dev *dev, static int __devinit driver_pci1723_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
...@@ -504,10 +467,16 @@ static void __devexit driver_pci1723_pci_remove(struct pci_dev *dev) ...@@ -504,10 +467,16 @@ static void __devexit driver_pci1723_pci_remove(struct pci_dev *dev)
comedi_pci_auto_unconfig(dev); comedi_pci_auto_unconfig(dev);
} }
static DEFINE_PCI_DEVICE_TABLE(pci1723_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1723) },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, pci1723_pci_table);
static struct pci_driver driver_pci1723_pci_driver = { static struct pci_driver driver_pci1723_pci_driver = {
.id_table = pci1723_pci_table, .id_table = pci1723_pci_table,
.probe = &driver_pci1723_pci_probe, .probe = driver_pci1723_pci_probe,
.remove = __devexit_p(&driver_pci1723_pci_remove) .remove = __devexit_p(driver_pci1723_pci_remove),
}; };
static int __init driver_pci1723_init_module(void) static int __init driver_pci1723_init_module(void)
...@@ -521,14 +490,13 @@ static int __init driver_pci1723_init_module(void) ...@@ -521,14 +490,13 @@ static int __init driver_pci1723_init_module(void)
driver_pci1723_pci_driver.name = (char *)driver_pci1723.driver_name; driver_pci1723_pci_driver.name = (char *)driver_pci1723.driver_name;
return pci_register_driver(&driver_pci1723_pci_driver); return pci_register_driver(&driver_pci1723_pci_driver);
} }
module_init(driver_pci1723_init_module);
static void __exit driver_pci1723_cleanup_module(void) static void __exit driver_pci1723_cleanup_module(void)
{ {
pci_unregister_driver(&driver_pci1723_pci_driver); pci_unregister_driver(&driver_pci1723_pci_driver);
comedi_driver_unregister(&driver_pci1723); comedi_driver_unregister(&driver_pci1723);
} }
module_init(driver_pci1723_init_module);
module_exit(driver_pci1723_cleanup_module); module_exit(driver_pci1723_cleanup_module);
MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_AUTHOR("Comedi http://www.comedi.org");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment