mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver
@ 2013-05-20 20:47 Peter Huewe
  2013-05-20 20:47 ` [PATCH 2/5] uio/uio_cif: " Peter Huewe
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Peter Huewe @ 2013-05-20 20:47 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: Greg Kroah-Hartman, linux-kernel, Peter Huewe

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 <peterhuewe@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);
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/5] uio/uio_cif: Use module_pci_driver to register driver
  2013-05-20 20:47 [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver Peter Huewe
@ 2013-05-20 20:47 ` Peter Huewe
  2013-05-20 20:47 ` [PATCH 3/5] uio/uio_netx: " Peter Huewe
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-05-20 20:47 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: Greg Kroah-Hartman, linux-kernel, Peter Huewe

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 <peterhuewe@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");
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/5] uio/uio_netx: Use module_pci_driver to register driver
  2013-05-20 20:47 [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver Peter Huewe
  2013-05-20 20:47 ` [PATCH 2/5] uio/uio_cif: " Peter Huewe
@ 2013-05-20 20:47 ` Peter Huewe
  2013-05-20 20:47 ` [PATCH 4/5] uio/uio_sercos3: " Peter Huewe
  2013-05-20 20:47 ` [PATCH 5/5] uio/uio_pci_generic: " Peter Huewe
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-05-20 20:47 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: Greg Kroah-Hartman, linux-kernel, Peter Huewe

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 <peterhuewe@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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/5] uio/uio_sercos3: Use module_pci_driver to register driver
  2013-05-20 20:47 [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver Peter Huewe
  2013-05-20 20:47 ` [PATCH 2/5] uio/uio_cif: " Peter Huewe
  2013-05-20 20:47 ` [PATCH 3/5] uio/uio_netx: " Peter Huewe
@ 2013-05-20 20:47 ` Peter Huewe
  2013-05-20 20:47 ` [PATCH 5/5] uio/uio_pci_generic: " Peter Huewe
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-05-20 20:47 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: Greg Kroah-Hartman, linux-kernel, Peter Huewe

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 <peterhuewe@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.ogness@linutronix.de>");
 MODULE_LICENSE("GPL v2");
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] uio/uio_pci_generic: Use module_pci_driver to register driver
  2013-05-20 20:47 [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver Peter Huewe
                   ` (2 preceding siblings ...)
  2013-05-20 20:47 ` [PATCH 4/5] uio/uio_sercos3: " Peter Huewe
@ 2013-05-20 20:47 ` Peter Huewe
  2013-05-21 17:09   ` Greg Kroah-Hartman
  3 siblings, 1 reply; 7+ messages in thread
From: Peter Huewe @ 2013-05-20 20:47 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: Greg Kroah-Hartman, linux-kernel, Peter Huewe

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 <peterhuewe@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);
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5/5] uio/uio_pci_generic: Use module_pci_driver to register driver
  2013-05-20 20:47 ` [PATCH 5/5] uio/uio_pci_generic: " Peter Huewe
@ 2013-05-21 17:09   ` Greg Kroah-Hartman
  2013-05-21 20:47     ` [PATCH v2] " Peter Huewe
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2013-05-21 17:09 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Hans J. Koch, linux-kernel

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 <peterhuewe@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 :(


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] uio/uio_pci_generic: Use module_pci_driver to register driver
  2013-05-21 17:09   ` Greg Kroah-Hartman
@ 2013-05-21 20:47     ` Peter Huewe
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-05-21 20:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Hans J. Koch, linux-kernel, Peter Huewe

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-05-21 20:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-20 20:47 [PATCH 1/5] uio/uio_aec: Use module_pci_driver to register driver Peter Huewe
2013-05-20 20:47 ` [PATCH 2/5] uio/uio_cif: " Peter Huewe
2013-05-20 20:47 ` [PATCH 3/5] uio/uio_netx: " Peter Huewe
2013-05-20 20:47 ` [PATCH 4/5] uio/uio_sercos3: " Peter Huewe
2013-05-20 20:47 ` [PATCH 5/5] uio/uio_pci_generic: " Peter Huewe
2013-05-21 17:09   ` Greg Kroah-Hartman
2013-05-21 20:47     ` [PATCH v2] " Peter Huewe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®