diff mbox series

[-next] tpm/tpm_tis_synquacer: Use module_platform_driver macro to simplify the code

Message ID 20230815080637.1100650-1-lizetao1@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] tpm/tpm_tis_synquacer: Use module_platform_driver macro to simplify the code | expand

Commit Message

lizetao Aug. 15, 2023, 8:06 a.m. UTC
Use the module_platform_driver macro to simplify the code, which is the
same as declaring with module_init() and module_exit().

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 drivers/char/tpm/tpm_tis_synquacer.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Jarkko Sakkinen Aug. 16, 2023, 8:16 p.m. UTC | #1
On Tue Aug 15, 2023 at 11:06 AM EEST, Li Zetao wrote:
> Use the module_platform_driver macro to simplify the code, which is the
> same as declaring with module_init() and module_exit().
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>  drivers/char/tpm/tpm_tis_synquacer.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_synquacer.c b/drivers/char/tpm/tpm_tis_synquacer.c
> index 49278746b0e2..f7d5e76b505e 100644
> --- a/drivers/char/tpm/tpm_tis_synquacer.c
> +++ b/drivers/char/tpm/tpm_tis_synquacer.c
> @@ -162,23 +162,7 @@ static struct platform_driver tis_synquacer_drv = {
>  	},
>  };
>  
> -static int __init tpm_tis_synquacer_module_init(void)
> -{
> -	int rc;
> -
> -	rc = platform_driver_register(&tis_synquacer_drv);
> -	if (rc)
> -		return rc;
> -
> -	return 0;
> -}
> -
> -static void __exit tpm_tis_synquacer_module_exit(void)
> -{
> -	platform_driver_unregister(&tis_synquacer_drv);
> -}
> +module_platform_driver(tis_synquacer_drv);
>  
> -module_init(tpm_tis_synquacer_module_init);
> -module_exit(tpm_tis_synquacer_module_exit);
>  MODULE_DESCRIPTION("TPM MMIO Driver for Socionext SynQuacer platform");
>  MODULE_LICENSE("GPL");
> -- 
> 2.34.1

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm_tis_synquacer.c b/drivers/char/tpm/tpm_tis_synquacer.c
index 49278746b0e2..f7d5e76b505e 100644
--- a/drivers/char/tpm/tpm_tis_synquacer.c
+++ b/drivers/char/tpm/tpm_tis_synquacer.c
@@ -162,23 +162,7 @@  static struct platform_driver tis_synquacer_drv = {
 	},
 };
 
-static int __init tpm_tis_synquacer_module_init(void)
-{
-	int rc;
-
-	rc = platform_driver_register(&tis_synquacer_drv);
-	if (rc)
-		return rc;
-
-	return 0;
-}
-
-static void __exit tpm_tis_synquacer_module_exit(void)
-{
-	platform_driver_unregister(&tis_synquacer_drv);
-}
+module_platform_driver(tis_synquacer_drv);
 
-module_init(tpm_tis_synquacer_module_init);
-module_exit(tpm_tis_synquacer_module_exit);
 MODULE_DESCRIPTION("TPM MMIO Driver for Socionext SynQuacer platform");
 MODULE_LICENSE("GPL");