public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vme: vme_tsi148.c: use module_pci_driver to simplify the code
@ 2012-10-18 15:12 Wei Yongjun
  2012-11-02 15:22 ` Martyn Welch
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-10-18 15:12 UTC (permalink / raw)
  To: martyn.welch, manohar.vanga, gregkh; +Cc: yongjun_wei, devel, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/vme/bridges/vme_tsi148.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 5fbd08f..9c1aa4d 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -35,10 +35,8 @@
 #include "../vme_bridge.h"
 #include "vme_tsi148.h"
 
-static int __init tsi148_init(void);
 static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
 static void tsi148_remove(struct pci_dev *);
-static void __exit tsi148_exit(void);
 
 
 /* Module parameter */
@@ -2244,11 +2242,6 @@ static void tsi148_free_consistent(struct device *parent, size_t size,
 	pci_free_consistent(pdev, size, vaddr, dma);
 }
 
-static int __init tsi148_init(void)
-{
-	return pci_register_driver(&tsi148_driver);
-}
-
 /*
  * Configure CR/CSR space
  *
@@ -2754,10 +2747,7 @@ static void tsi148_remove(struct pci_dev *pdev)
 	kfree(tsi148_bridge);
 }
 
-static void __exit tsi148_exit(void)
-{
-	pci_unregister_driver(&tsi148_driver);
-}
+module_pci_driver(tsi148_driver);
 
 MODULE_PARM_DESC(err_chk, "Check for VME errors on reads and writes");
 module_param(err_chk, bool, 0);
@@ -2767,6 +2757,3 @@ module_param(geoid, int, 0);
 
 MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge");
 MODULE_LICENSE("GPL");
-
-module_init(tsi148_init);
-module_exit(tsi148_exit);


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

* Re: [PATCH] vme: vme_tsi148.c: use module_pci_driver to simplify the code
  2012-10-18 15:12 [PATCH] vme: vme_tsi148.c: use module_pci_driver to simplify the code Wei Yongjun
@ 2012-11-02 15:22 ` Martyn Welch
  0 siblings, 0 replies; 2+ messages in thread
From: Martyn Welch @ 2012-11-02 15:22 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: manohar.vanga, gregkh, yongjun_wei, devel, linux-kernel

On 18/10/2012 16:12, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use the module_pci_driver() macro to make the code simpler
> by eliminating module_init and module_exit calls.
>
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Huh, learn something new every day :-)

Acked-by: Martyn Welch <martyn.welch@ge.com>

Thanks,

Martyn

> ---
>   drivers/vme/bridges/vme_tsi148.c | 15 +--------------
>   1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
> index 5fbd08f..9c1aa4d 100644
> --- a/drivers/vme/bridges/vme_tsi148.c
> +++ b/drivers/vme/bridges/vme_tsi148.c
> @@ -35,10 +35,8 @@
>   #include "../vme_bridge.h"
>   #include "vme_tsi148.h"
>
> -static int __init tsi148_init(void);
>   static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
>   static void tsi148_remove(struct pci_dev *);
> -static void __exit tsi148_exit(void);
>
>
>   /* Module parameter */
> @@ -2244,11 +2242,6 @@ static void tsi148_free_consistent(struct device *parent, size_t size,
>   	pci_free_consistent(pdev, size, vaddr, dma);
>   }
>
> -static int __init tsi148_init(void)
> -{
> -	return pci_register_driver(&tsi148_driver);
> -}
> -
>   /*
>    * Configure CR/CSR space
>    *
> @@ -2754,10 +2747,7 @@ static void tsi148_remove(struct pci_dev *pdev)
>   	kfree(tsi148_bridge);
>   }
>
> -static void __exit tsi148_exit(void)
> -{
> -	pci_unregister_driver(&tsi148_driver);
> -}
> +module_pci_driver(tsi148_driver);
>
>   MODULE_PARM_DESC(err_chk, "Check for VME errors on reads and writes");
>   module_param(err_chk, bool, 0);
> @@ -2767,6 +2757,3 @@ module_param(geoid, int, 0);
>
>   MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge");
>   MODULE_LICENSE("GPL");
> -
> -module_init(tsi148_init);
> -module_exit(tsi148_exit);
>


-- 
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms               | (3828642) at 100 Barbirolli Square
T +44(0)1327322748                     | Manchester, M2 3AB
E martyn.welch@ge.com                  | VAT:GB 927559189


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

end of thread, other threads:[~2012-11-02 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18 15:12 [PATCH] vme: vme_tsi148.c: use module_pci_driver to simplify the code Wei Yongjun
2012-11-02 15:22 ` Martyn Welch

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