diff mbox series

[v2,2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall

Message ID 20201030034654.15775-3-zhang.lyra@gmail.com (mailing list archive)
State New
Headers show
Series fixes and improvement for sprd hwspinlock | expand

Commit Message

Chunyan Zhang Oct. 30, 2020, 3:46 a.m. UTC
From: Chunyan Zhang <chunyan.zhang@unisoc.com>

The hardware spinlock devices are defined in the DT, there's no need for
init calls order, remove boilerplate code by using module_platform_driver.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/hwspinlock/sprd_hwspinlock.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Bjorn Andersson Nov. 3, 2020, 12:40 a.m. UTC | #1
On Thu 29 Oct 22:46 CDT 2020, Chunyan Zhang wrote:

> From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> 
> The hardware spinlock devices are defined in the DT, there's no need for
> init calls order, remove boilerplate code by using module_platform_driver.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>

Applied this patch with Baolin's r-b.

Thank you,
Bjorn

> ---
>  drivers/hwspinlock/sprd_hwspinlock.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c
> index 4c63e2546064..19d1924044e5 100644
> --- a/drivers/hwspinlock/sprd_hwspinlock.c
> +++ b/drivers/hwspinlock/sprd_hwspinlock.c
> @@ -151,18 +151,7 @@ static struct platform_driver sprd_hwspinlock_driver = {
>  		.of_match_table = of_match_ptr(sprd_hwspinlock_of_match),
>  	},
>  };
> -
> -static int __init sprd_hwspinlock_init(void)
> -{
> -	return platform_driver_register(&sprd_hwspinlock_driver);
> -}
> -postcore_initcall(sprd_hwspinlock_init);
> -
> -static void __exit sprd_hwspinlock_exit(void)
> -{
> -	platform_driver_unregister(&sprd_hwspinlock_driver);
> -}
> -module_exit(sprd_hwspinlock_exit);
> +module_platform_driver(sprd_hwspinlock_driver);
>  
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("Hardware spinlock driver for Spreadtrum");
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c
index 4c63e2546064..19d1924044e5 100644
--- a/drivers/hwspinlock/sprd_hwspinlock.c
+++ b/drivers/hwspinlock/sprd_hwspinlock.c
@@ -151,18 +151,7 @@  static struct platform_driver sprd_hwspinlock_driver = {
 		.of_match_table = of_match_ptr(sprd_hwspinlock_of_match),
 	},
 };
-
-static int __init sprd_hwspinlock_init(void)
-{
-	return platform_driver_register(&sprd_hwspinlock_driver);
-}
-postcore_initcall(sprd_hwspinlock_init);
-
-static void __exit sprd_hwspinlock_exit(void)
-{
-	platform_driver_unregister(&sprd_hwspinlock_driver);
-}
-module_exit(sprd_hwspinlock_exit);
+module_platform_driver(sprd_hwspinlock_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Hardware spinlock driver for Spreadtrum");