Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 3/5] uio/uio_netx: Use module_pci_driver to register driver

7 views
Skip to first unread message

Peter Huewe

unread,
May 20, 2013, 4:50:01 PM5/20/13
to
Removing some boilerplate by using module_pci_driver instead of calling
register and unregister in the otherwise empty init/exit functions.

Signed-off-by: Peter Huewe <peter...@gmx.de>
---
drivers/uio/uio_netx.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c
index 6a4ba5e..28a766b 100644
--- a/drivers/uio/uio_netx.c
+++ b/drivers/uio/uio_netx.c
@@ -174,19 +174,7 @@ static struct pci_driver netx_pci_driver = {
.remove = netx_pci_remove,
};

-static int __init netx_init_module(void)
-{
- return pci_register_driver(&netx_pci_driver);
-}
-
-static void __exit netx_exit_module(void)
-{
- pci_unregister_driver(&netx_pci_driver);
-}
-
-module_init(netx_init_module);
-module_exit(netx_exit_module);
-
+module_pci_driver(netx_pci_driver);
MODULE_DEVICE_TABLE(pci, netx_pci_ids);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Hans J. Koch, Manuel Traut");
--
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Peter Huewe

unread,
May 20, 2013, 4:50:01 PM5/20/13
to
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.

Signed-off-by: Peter Huewe <peter...@gmx.de>
---
drivers/uio/uio_pci_generic.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index 14aa10c..a11b51a 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -120,20 +120,7 @@ static struct pci_driver driver = {
.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(driver);
MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR(DRIVER_AUTHOR);

Peter Huewe

unread,
May 20, 2013, 4:50:02 PM5/20/13
to
Removing some boilerplate by using module_pci_driver instead of calling
register and unregister in the otherwise empty init/exit functions.

Signed-off-by: Peter Huewe <peter...@gmx.de>
---
drivers/uio/uio_sercos3.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/uio/uio_sercos3.c b/drivers/uio/uio_sercos3.c
index 81a10a5..5419832 100644
--- a/drivers/uio/uio_sercos3.c
+++ b/drivers/uio/uio_sercos3.c
@@ -226,19 +226,7 @@ static struct pci_driver sercos3_pci_driver = {
.remove = sercos3_pci_remove,
};

-static int __init sercos3_init_module(void)
-{
- return pci_register_driver(&sercos3_pci_driver);
-}
-
-static void __exit sercos3_exit_module(void)
-{
- pci_unregister_driver(&sercos3_pci_driver);
-}
-
-module_init(sercos3_init_module);
-module_exit(sercos3_exit_module);
-
+module_pci_driver(sercos3_pci_driver);
MODULE_DESCRIPTION("UIO driver for the Automata Sercos III PCI card");
MODULE_AUTHOR("John Ogness <john....@linutronix.de>");
MODULE_LICENSE("GPL v2");

Peter Huewe

unread,
May 20, 2013, 4:50:01 PM5/20/13
to
Removing some boilerplate by using module_pci_driver instead of calling
register and unregister in the otherwise empty init/exit functions.

Signed-off-by: Peter Huewe <peter...@gmx.de>
---
drivers/uio/uio_aec.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/uio/uio_aec.c b/drivers/uio/uio_aec.c
index 1548982..f3611c2 100644
--- a/drivers/uio/uio_aec.c
+++ b/drivers/uio/uio_aec.c
@@ -160,17 +160,5 @@ static struct pci_driver pci_driver = {
.remove = remove,
};

-static int __init aectc_init(void)
-{
- return pci_register_driver(&pci_driver);
-}
-
-static void __exit aectc_exit(void)
-{
- pci_unregister_driver(&pci_driver);
-}
-
+module_pci_driver(pci_driver);
MODULE_LICENSE("GPL");
-
-module_init(aectc_init);
-module_exit(aectc_exit);

Peter Huewe

unread,
May 20, 2013, 4:50:01 PM5/20/13
to
Removing some boilerplate by using module_pci_driver instead of calling
register and unregister in the otherwise empty init/exit functions.

Signed-off-by: Peter Huewe <peter...@gmx.de>
---
drivers/uio/uio_cif.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c
index 7dd6fc6..22cdf38 100644
--- a/drivers/uio/uio_cif.c
+++ b/drivers/uio/uio_cif.c
@@ -135,19 +135,7 @@ static struct pci_driver hilscher_pci_driver = {
.remove = hilscher_pci_remove,
};

-static int __init hilscher_init_module(void)
-{
- return pci_register_driver(&hilscher_pci_driver);
-}
-
-static void __exit hilscher_exit_module(void)
-{
- pci_unregister_driver(&hilscher_pci_driver);
-}
-
-module_init(hilscher_init_module);
-module_exit(hilscher_exit_module);
-
+module_pci_driver(hilscher_pci_driver);
MODULE_DEVICE_TABLE(pci, hilscher_pci_ids);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Hans J. Koch, Benedikt Spranger");

Greg Kroah-Hartman

unread,
May 21, 2013, 1:20:04 PM5/21/13
to
On Mon, May 20, 2013 at 10:47:45PM +0200, Peter Huewe wrote:
> 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.
>
> Signed-off-by: Peter Huewe <peter...@gmx.de>
> ---
> drivers/uio/uio_pci_generic.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)

Please test build your changes, this one breaks the build :(

Peter Huewe

unread,
May 21, 2013, 4:50:02 PM5/21/13
to
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 <peter...@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

0 new messages