2022-08-30 08:53:33

by Zhang Jianhua

[permalink] [raw]
Subject: [PATCH -next v2] cpufreq: bmips-cpufreq: Use module_init and add module_exit

- Use module_init instead of device_initcall.
- Add a function for module_exit to unregister driver.

Signed-off-by: Zhang Jianhua <[email protected]>
---
v2:
- add semicolon after module_exit to keep the format consistent
---
drivers/cpufreq/bmips-cpufreq.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/bmips-cpufreq.c b/drivers/cpufreq/bmips-cpufreq.c
index f7c23fa468f0..39221a9a187a 100644
--- a/drivers/cpufreq/bmips-cpufreq.c
+++ b/drivers/cpufreq/bmips-cpufreq.c
@@ -156,7 +156,7 @@ static struct cpufreq_driver bmips_cpufreq_driver = {
.name = BMIPS_CPUFREQ_PREFIX,
};

-static int __init bmips_cpufreq_probe(void)
+static int __init bmips_cpufreq_driver_init(void)
{
struct cpufreq_compat *cc;
struct device_node *np;
@@ -176,7 +176,13 @@ static int __init bmips_cpufreq_probe(void)

return cpufreq_register_driver(&bmips_cpufreq_driver);
}
-device_initcall(bmips_cpufreq_probe);
+module_init(bmips_cpufreq_driver_init);
+
+static void __exit bmips_cpufreq_driver_exit(void)
+{
+ cpufreq_unregister_driver(&bmips_cpufreq_driver);
+}
+module_exit(bmips_cpufreq_driver_exit);

MODULE_AUTHOR("Markus Mayer <[email protected]>");
MODULE_DESCRIPTION("CPUfreq driver for Broadcom BMIPS SoCs");
--
2.31.0


2022-08-30 08:57:36

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH -next v2] cpufreq: bmips-cpufreq: Use module_init and add module_exit

On 30-08-22, 16:07, Zhang Jianhua wrote:
> - Use module_init instead of device_initcall.
> - Add a function for module_exit to unregister driver.
>
> Signed-off-by: Zhang Jianhua <[email protected]>
> ---
> v2:
> - add semicolon after module_exit to keep the format consistent
> ---
> drivers/cpufreq/bmips-cpufreq.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/bmips-cpufreq.c b/drivers/cpufreq/bmips-cpufreq.c
> index f7c23fa468f0..39221a9a187a 100644
> --- a/drivers/cpufreq/bmips-cpufreq.c
> +++ b/drivers/cpufreq/bmips-cpufreq.c
> @@ -156,7 +156,7 @@ static struct cpufreq_driver bmips_cpufreq_driver = {
> .name = BMIPS_CPUFREQ_PREFIX,
> };
>
> -static int __init bmips_cpufreq_probe(void)
> +static int __init bmips_cpufreq_driver_init(void)
> {
> struct cpufreq_compat *cc;
> struct device_node *np;
> @@ -176,7 +176,13 @@ static int __init bmips_cpufreq_probe(void)
>
> return cpufreq_register_driver(&bmips_cpufreq_driver);
> }
> -device_initcall(bmips_cpufreq_probe);
> +module_init(bmips_cpufreq_driver_init);
> +
> +static void __exit bmips_cpufreq_driver_exit(void)
> +{
> + cpufreq_unregister_driver(&bmips_cpufreq_driver);
> +}
> +module_exit(bmips_cpufreq_driver_exit);
>
> MODULE_AUTHOR("Markus Mayer <[email protected]>");
> MODULE_DESCRIPTION("CPUfreq driver for Broadcom BMIPS SoCs");

Applied. Thanks.

--
viresh