2014-12-09 13:14:22

by weiyj_lk

[permalink] [raw]
Subject: [PATCH -next] coresight-tpiu: use module_amba_driver to simplify the code

From: Wei Yongjun <[email protected]>

module_amba_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/coresight/coresight-tpiu.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/coresight/coresight-tpiu.c b/drivers/coresight/coresight-tpiu.c
index ae10108..3b33af2 100644
--- a/drivers/coresight/coresight-tpiu.c
+++ b/drivers/coresight/coresight-tpiu.c
@@ -201,17 +201,7 @@ static struct amba_driver tpiu_driver = {
.id_table = tpiu_ids,
};

-static int __init tpiu_init(void)
-{
- return amba_driver_register(&tpiu_driver);
-}
-module_init(tpiu_init);
-
-static void __exit tpiu_exit(void)
-{
- amba_driver_unregister(&tpiu_driver);
-}
-module_exit(tpiu_exit);
+module_amba_driver(tpiu_driver);

MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("CoreSight Trace Port Interface Unit driver");


2014-12-11 17:56:35

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH -next] coresight-tpiu: use module_amba_driver to simplify the code

On 9 December 2014 at 06:13, <[email protected]> wrote:
> From: Wei Yongjun <[email protected]>
>
> module_amba_driver() makes the code simpler by eliminating
> boilerplate code.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/coresight/coresight-tpiu.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/coresight/coresight-tpiu.c b/drivers/coresight/coresight-tpiu.c
> index ae10108..3b33af2 100644
> --- a/drivers/coresight/coresight-tpiu.c
> +++ b/drivers/coresight/coresight-tpiu.c
> @@ -201,17 +201,7 @@ static struct amba_driver tpiu_driver = {
> .id_table = tpiu_ids,
> };
>
> -static int __init tpiu_init(void)
> -{
> - return amba_driver_register(&tpiu_driver);
> -}
> -module_init(tpiu_init);
> -
> -static void __exit tpiu_exit(void)
> -{
> - amba_driver_unregister(&tpiu_driver);
> -}
> -module_exit(tpiu_exit);
> +module_amba_driver(tpiu_driver);

This looks good - please merge your 4 patches in the same one.

>
> MODULE_LICENSE("GPL v2");
> MODULE_DESCRIPTION("CoreSight Trace Port Interface Unit driver");
>