diff mbox series

misc: xilinx-sdfec: convert to module_platform_driver()

Message ID 20200510164308.31358-1-harshalchau04@gmail.com (mailing list archive)
State Mainlined
Commit 286adb4cce00d2ed37eb20a19ce366d1d58adf42
Headers show
Series misc: xilinx-sdfec: convert to module_platform_driver() | expand

Commit Message

harshal chaudhari May 10, 2020, 4:43 p.m. UTC
The driver init and exit function don't do anything besides registering
and unregistering the platform driver, so the module_platform_driver()
macro could just be used instead of having separate functions.

Signed-off-by: Harshal Chaudhari <harshalchau04@gmail.com>
---
 drivers/misc/xilinx_sdfec.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

Comments

Dragan Cvetic May 11, 2020, 2:12 p.m. UTC | #1
> -----Original Message-----
> From: Harshal Chaudhari <harshalchau04@gmail.com>
> Sent: Sunday 10 May 2020 17:43
> To: gregkh@linuxfoundation.org
> Cc: Derek Kiernan <dkiernan@xilinx.com>; Dragan Cvetic <draganc@xilinx.com>; arnd@arndb.de; Michal Simek
> <michals@xilinx.com>; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; harshalchau04@gmail.com
> Subject: [PATCH] misc: xilinx-sdfec: convert to module_platform_driver()
> 
> The driver init and exit function don't do anything besides registering
> and unregistering the platform driver, so the module_platform_driver()
> macro could just be used instead of having separate functions.
> 
> Signed-off-by: Harshal Chaudhari <harshalchau04@gmail.com>
> ---
>  drivers/misc/xilinx_sdfec.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)
> 
> diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
> index 71bbaa56bdb5..db16a42c66f4 100644
> --- a/drivers/misc/xilinx_sdfec.c
> +++ b/drivers/misc/xilinx_sdfec.c
> @@ -1484,25 +1484,7 @@ static struct platform_driver xsdfec_driver = {
>  	.remove =  xsdfec_remove,
>  };
> 
> -static int __init xsdfec_init(void)
> -{
> -	int err;
> -
> -	err = platform_driver_register(&xsdfec_driver);
> -	if (err < 0) {
> -		pr_err("%s Unabled to register SDFEC driver", __func__);
> -		return err;
> -	}
> -	return 0;
> -}
> -
> -static void __exit xsdfec_exit(void)
> -{
> -	platform_driver_unregister(&xsdfec_driver);
> -}
> -
> -module_init(xsdfec_init);
> -module_exit(xsdfec_exit);
> +module_platform_driver(xsdfec_driver);
> 
>  MODULE_AUTHOR("Xilinx, Inc");
>  MODULE_DESCRIPTION("Xilinx SD-FEC16 Driver");
> --
> 2.17.1

Acked-by: Dragan Cvetic <dragan.cvetic@xilinx.com>

Thanks
Dragan
diff mbox series

Patch

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 71bbaa56bdb5..db16a42c66f4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1484,25 +1484,7 @@  static struct platform_driver xsdfec_driver = {
 	.remove =  xsdfec_remove,
 };
 
-static int __init xsdfec_init(void)
-{
-	int err;
-
-	err = platform_driver_register(&xsdfec_driver);
-	if (err < 0) {
-		pr_err("%s Unabled to register SDFEC driver", __func__);
-		return err;
-	}
-	return 0;
-}
-
-static void __exit xsdfec_exit(void)
-{
-	platform_driver_unregister(&xsdfec_driver);
-}
-
-module_init(xsdfec_init);
-module_exit(xsdfec_exit);
+module_platform_driver(xsdfec_driver);
 
 MODULE_AUTHOR("Xilinx, Inc");
 MODULE_DESCRIPTION("Xilinx SD-FEC16 Driver");