From: Ian Abbott Date: Fri, 14 Sep 2012 16:34:00 +0000 (+0100) Subject: staging: comedi: ni_6527: use module_comedi_pci_driver() X-Git-Tag: next-20120918~21^2~89 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7ae09413c7195f87d02e7fd0a67ba6dafbab4546;p=karo-tx-linux.git staging: comedi: ni_6527: use module_comedi_pci_driver() Use the macro `module_comedi_pci_driver(comedi_driver, pci_driver)` to register the module as a Comedi PCI driver. Rename variables and functions that have prefix `driver_` for consistency. Set the `name` member of the `struct pci_driver` variable in its initializer instead of initializing it in the module initialization function. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 6f0659a58b69..79e756b2eb15 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -81,7 +81,7 @@ Updated: Sat, 25 Jan 2003 13:24:40 -0800 static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it); static void ni6527_detach(struct comedi_device *dev); -static struct comedi_driver driver_ni6527 = { +static struct comedi_driver ni6527_driver = { .driver_name = DRIVER_NAME, .module = THIS_MODULE, .attach = ni6527_attach, @@ -478,43 +478,24 @@ static int ni6527_find_device(struct comedi_device *dev, int bus, int slot) return -EIO; } -static int __devinit driver_ni6527_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) +static int __devinit ni6527_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) { - return comedi_pci_auto_config(dev, &driver_ni6527); + return comedi_pci_auto_config(dev, &ni6527_driver); } -static void __devexit driver_ni6527_pci_remove(struct pci_dev *dev) +static void __devexit ni6527_pci_remove(struct pci_dev *dev) { comedi_pci_auto_unconfig(dev); } -static struct pci_driver driver_ni6527_pci_driver = { +static struct pci_driver ni6527_pci_driver = { + .name = DRIVER_NAME, .id_table = ni6527_pci_table, - .probe = &driver_ni6527_pci_probe, - .remove = __devexit_p(&driver_ni6527_pci_remove) + .probe = ni6527_pci_probe, + .remove = __devexit_p(ni6527_pci_remove) }; - -static int __init driver_ni6527_init_module(void) -{ - int retval; - - retval = comedi_driver_register(&driver_ni6527); - if (retval < 0) - return retval; - - driver_ni6527_pci_driver.name = (char *)driver_ni6527.driver_name; - return pci_register_driver(&driver_ni6527_pci_driver); -} - -static void __exit driver_ni6527_cleanup_module(void) -{ - pci_unregister_driver(&driver_ni6527_pci_driver); - comedi_driver_unregister(&driver_ni6527); -} - -module_init(driver_ni6527_init_module); -module_exit(driver_ni6527_cleanup_module); +module_comedi_pci_driver(ni6527_driver, ni6527_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver");