diff mbox series

[-next] thermal/drivers/int340x: simplify the code with module_platform_driver

Message ID 20230804092101.1354476-1-yangyingliang@huawei.com (mailing list archive)
State Mainlined, archived
Headers show
Series [-next] thermal/drivers/int340x: simplify the code with module_platform_driver | expand

Commit Message

Yang Yingliang Aug. 4, 2023, 9:21 a.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>
---
 .../thermal/intel/int340x_thermal/int3401_thermal.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Rafael J. Wysocki Aug. 22, 2023, 7:47 p.m. UTC | #1
On Fri, Aug 4, 2023 at 11:24 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> 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>
> ---
>  .../thermal/intel/int340x_thermal/int3401_thermal.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> index 217786fba185..c93a28eec4db 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> @@ -70,18 +70,7 @@ static struct platform_driver int3401_driver = {
>         },
>  };
>
> -static int __init proc_thermal_init(void)
> -{
> -       return platform_driver_register(&int3401_driver);
> -}
> -
> -static void __exit proc_thermal_exit(void)
> -{
> -       platform_driver_unregister(&int3401_driver);
> -}
> -
> -module_init(proc_thermal_init);
> -module_exit(proc_thermal_exit);
> +module_platform_driver(int3401_driver);
>
>  MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
>  MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
> --

Applied (with some edits in the subject and changelog) as 6.6 material, thanks!
diff mbox series

Patch

diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
index 217786fba185..c93a28eec4db 100644
--- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
@@ -70,18 +70,7 @@  static struct platform_driver int3401_driver = {
 	},
 };
 
-static int __init proc_thermal_init(void)
-{
-	return platform_driver_register(&int3401_driver);
-}
-
-static void __exit proc_thermal_exit(void)
-{
-	platform_driver_unregister(&int3401_driver);
-}
-
-module_init(proc_thermal_init);
-module_exit(proc_thermal_exit);
+module_platform_driver(int3401_driver);
 
 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");