diff mbox series

[-next] ASoC: ti: davinci-evm: simplify the code with module_platform_driver

Message ID 20230112135457.1490360-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] ASoC: ti: davinci-evm: simplify the code with module_platform_driver | expand

Commit Message

Yang Yingliang Jan. 12, 2023, 1:54 p.m. UTC
The init/exit() of driver only calls platform_driver_register/unregister,
it can be simpilfied with module_platform_driver.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 sound/soc/ti/davinci-evm.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Péter Ujfalusi Jan. 13, 2023, 9:25 p.m. UTC | #1
On 1/12/23 15:54, Yang Yingliang wrote:
> The init/exit() of driver only calls platform_driver_register/unregister,
> it can be simpilfied with module_platform_driver.

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  sound/soc/ti/davinci-evm.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-evm.c b/sound/soc/ti/davinci-evm.c
> index 983d69b951b0..544cb3da50eb 100644
> --- a/sound/soc/ti/davinci-evm.c
> +++ b/sound/soc/ti/davinci-evm.c
> @@ -257,18 +257,7 @@ static struct platform_driver davinci_evm_driver = {
>  	},
>  };
>  
> -static int __init evm_init(void)
> -{
> -	return platform_driver_register(&davinci_evm_driver);
> -}
> -
> -static void __exit evm_exit(void)
> -{
> -	platform_driver_unregister(&davinci_evm_driver);
> -}
> -
> -module_init(evm_init);
> -module_exit(evm_exit);
> +module_platform_driver(davinci_evm_driver);
>  
>  MODULE_AUTHOR("Vladimir Barinov");
>  MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver");
Mark Brown Jan. 19, 2023, 2:29 p.m. UTC | #2
On Thu, Jan 12, 2023 at 09:54:57PM +0800, Yang Yingliang wrote:
> The init/exit() of driver only calls platform_driver_register/unregister,
> it can be simpilfied with module_platform_driver.

This doesn't apply against current code, please check and resend.
Yang Yingliang Jan. 30, 2023, 2:22 a.m. UTC | #3
On 2023/1/19 22:29, Mark Brown wrote:
> On Thu, Jan 12, 2023 at 09:54:57PM +0800, Yang Yingliang wrote:
>> The init/exit() of driver only calls platform_driver_register/unregister,
>> it can be simpilfied with module_platform_driver.
> This doesn't apply against current code, please check and resend.
Because commit efe81e9a9273 ("ASoC: remove unused davinci support") is 
not merged yet,
I will resend it after it's merged.

Thanks,
Yang
diff mbox series

Patch

diff --git a/sound/soc/ti/davinci-evm.c b/sound/soc/ti/davinci-evm.c
index 983d69b951b0..544cb3da50eb 100644
--- a/sound/soc/ti/davinci-evm.c
+++ b/sound/soc/ti/davinci-evm.c
@@ -257,18 +257,7 @@  static struct platform_driver davinci_evm_driver = {
 	},
 };
 
-static int __init evm_init(void)
-{
-	return platform_driver_register(&davinci_evm_driver);
-}
-
-static void __exit evm_exit(void)
-{
-	platform_driver_unregister(&davinci_evm_driver);
-}
-
-module_init(evm_init);
-module_exit(evm_exit);
+module_platform_driver(davinci_evm_driver);
 
 MODULE_AUTHOR("Vladimir Barinov");
 MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver");