Skip to content

Commit

Permalink
staging: comedi: ni_65xx: use module_comedi_pci_driver()
Browse files Browse the repository at this point in the history
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 <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Sep 17, 2012
1 parent 0e5789f commit 7e66129
Showing 1 changed file with 10 additions and 29 deletions.
39 changes: 10 additions & 29 deletions drivers/staging/comedi/drivers/ni_65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static inline unsigned Filter_Enable(unsigned port)
static int ni_65xx_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static void ni_65xx_detach(struct comedi_device *dev);
static struct comedi_driver driver_ni_65xx = {
static struct comedi_driver ni_65xx_driver = {
.driver_name = "ni_65xx",
.module = THIS_MODULE,
.attach = ni_65xx_attach,
Expand Down Expand Up @@ -822,43 +822,24 @@ static int ni_65xx_find_device(struct comedi_device *dev, int bus, int slot)
return -EIO;
}

static int __devinit driver_ni_65xx_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
static int __devinit ni_65xx_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, &driver_ni_65xx);
return comedi_pci_auto_config(dev, &ni_65xx_driver);
}

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

static struct pci_driver driver_ni_65xx_pci_driver = {
static struct pci_driver ni_65xx_pci_driver = {
.name = "ni_65xx",
.id_table = ni_65xx_pci_table,
.probe = &driver_ni_65xx_pci_probe,
.remove = __devexit_p(&driver_ni_65xx_pci_remove)
.probe = ni_65xx_pci_probe,
.remove = __devexit_p(ni_65xx_pci_remove)
};

static int __init driver_ni_65xx_init_module(void)
{
int retval;

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

driver_ni_65xx_pci_driver.name = (char *)driver_ni_65xx.driver_name;
return pci_register_driver(&driver_ni_65xx_pci_driver);
}

static void __exit driver_ni_65xx_cleanup_module(void)
{
pci_unregister_driver(&driver_ni_65xx_pci_driver);
comedi_driver_unregister(&driver_ni_65xx);
}

module_init(driver_ni_65xx_init_module);
module_exit(driver_ni_65xx_cleanup_module);
module_comedi_pci_driver(ni_65xx_driver, ni_65xx_pci_driver);

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

0 comments on commit 7e66129

Please sign in to comment.