Messages in this thread Patch in this message | | | From | Peter Huewe <> | Subject | [PATCH v2] uio/uio_pci_generic: Use module_pci_driver to register driver | Date | Tue, 21 May 2013 22:47:44 +0200 |
| |
Removing some boilerplate by using module_pci_driver instead of calling register and unregister in the otherwise empty init/exit functions.
It removes a pr_info showing some details about the driver, but these infos can also be retrieved by using modinfo.
The name of the pci_driver struct had to be changed in order to prevent a build failure.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de> --- Sorry for the build failure.
drivers/uio/uio_pci_generic.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c index 14aa10c..077ae12 100644 --- a/drivers/uio/uio_pci_generic.c +++ b/drivers/uio/uio_pci_generic.c @@ -113,27 +113,14 @@ static void remove(struct pci_dev *pdev) kfree(gdev); } -static struct pci_driver driver = { +static struct pci_driver uio_pci_driver = { .name = "uio_pci_generic", .id_table = NULL, /* only dynamic id's */ .probe = probe, .remove = remove, }; -static int __init init(void) -{ - pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); - return pci_register_driver(&driver); -} - -static void __exit cleanup(void) -{ - pci_unregister_driver(&driver); -} - -module_init(init); -module_exit(cleanup); - +module_pci_driver(uio_pci_driver); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR(DRIVER_AUTHOR); -- 1.8.1.5
| |