diff mbox series

[v1,6/7] powercap/dtpm/dtpm_cpu: Add exit function

Message ID 20220130210210.549877-6-daniel.lezcano@linaro.org (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series [v1,1/7] powercap/dtpm: Change locking scheme | expand

Commit Message

Daniel Lezcano Jan. 30, 2022, 9:02 p.m. UTC
Now that we can destroy the hierarchy, the code must remove what it
had put in place at the creation. In our case, the cpu hotplug
callbacks.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/powercap/dtpm_cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Ulf Hansson Feb. 17, 2022, 1:20 p.m. UTC | #1
On Sun, 30 Jan 2022 at 22:02, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> Now that we can destroy the hierarchy, the code must remove what it
> had put in place at the creation. In our case, the cpu hotplug
> callbacks.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/powercap/dtpm_cpu.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
> index 71f45d2f5a60..bca2f912d349 100644
> --- a/drivers/powercap/dtpm_cpu.c
> +++ b/drivers/powercap/dtpm_cpu.c
> @@ -299,8 +299,15 @@ static int dtpm_cpu_init(void)
>         return 0;
>  }
>
> +static void dtpm_cpu_exit(void)
> +{
> +       cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
> +       cpuhp_remove_state_nocalls(CPUHP_AP_DTPM_CPU_DEAD);
> +}
> +
>  struct dtpm_subsys_ops dtpm_cpu_ops = {
>         .name = KBUILD_MODNAME,
>         .init = dtpm_cpu_init,
> +       .exit = dtpm_cpu_exit,
>         .setup = dtpm_cpu_setup,
>  };
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index 71f45d2f5a60..bca2f912d349 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -299,8 +299,15 @@  static int dtpm_cpu_init(void)
 	return 0;
 }
 
+static void dtpm_cpu_exit(void)
+{
+	cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
+	cpuhp_remove_state_nocalls(CPUHP_AP_DTPM_CPU_DEAD);
+}
+
 struct dtpm_subsys_ops dtpm_cpu_ops = {
 	.name = KBUILD_MODNAME,
 	.init = dtpm_cpu_init,
+	.exit = dtpm_cpu_exit,
 	.setup = dtpm_cpu_setup,
 };