diff mbox series

cpuidle: psci: Drop superfluous wrappers psci_dt_attach|detach_cpu()

Message ID 20240228151139.2650258-1-ulf.hansson@linaro.org (mailing list archive)
State New, archived
Headers show
Series cpuidle: psci: Drop superfluous wrappers psci_dt_attach|detach_cpu() | expand

Commit Message

Ulf Hansson Feb. 28, 2024, 3:11 p.m. UTC
To simplify the code, let's drop psci_dt_attach|detach_cpu() and use the
common dt_idle_attach|detach_cpu() directly instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/cpuidle/cpuidle-psci-domain.c |  1 +
 drivers/cpuidle/cpuidle-psci.c        |  5 +++--
 drivers/cpuidle/cpuidle-psci.h        | 20 --------------------
 3 files changed, 4 insertions(+), 22 deletions(-)

Comments

Sudeep Holla Feb. 28, 2024, 5:05 p.m. UTC | #1
On Wed, Feb 28, 2024 at 04:11:39PM +0100, Ulf Hansson wrote:
> To simplify the code, let's drop psci_dt_attach|detach_cpu() and use the
> common dt_idle_attach|detach_cpu() directly instead.
>

LGTM,

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep
Ulf Hansson April 4, 2024, 11:06 a.m. UTC | #2
On Wed, 28 Feb 2024 at 16:11, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> To simplify the code, let's drop psci_dt_attach|detach_cpu() and use the
> common dt_idle_attach|detach_cpu() directly instead.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Queued up for next via my linux-pm.git (pmdomain), thanks!

Kind regards
Uffe


> ---
>  drivers/cpuidle/cpuidle-psci-domain.c |  1 +
>  drivers/cpuidle/cpuidle-psci.c        |  5 +++--
>  drivers/cpuidle/cpuidle-psci.h        | 20 --------------------
>  3 files changed, 4 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index b88af1262f1a..2b47811d986f 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -20,6 +20,7 @@
>  #include <linux/string.h>
>
>  #include "cpuidle-psci.h"
> +#include "dt_idle_genpd.h"
>
>  struct psci_pd_provider {
>         struct list_head link;
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index bf68920d038a..782030a27703 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -28,6 +28,7 @@
>
>  #include "cpuidle-psci.h"
>  #include "dt_idle_states.h"
> +#include "dt_idle_genpd.h"
>
>  struct psci_cpuidle_data {
>         u32 *psci_states;
> @@ -224,7 +225,7 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
>         if (IS_ENABLED(CONFIG_PREEMPT_RT))
>                 return 0;
>
> -       data->dev = psci_dt_attach_cpu(cpu);
> +       data->dev = dt_idle_attach_cpu(cpu, "psci");
>         if (IS_ERR_OR_NULL(data->dev))
>                 return PTR_ERR_OR_ZERO(data->dev);
>
> @@ -311,7 +312,7 @@ static void psci_cpu_deinit_idle(int cpu)
>  {
>         struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu);
>
> -       psci_dt_detach_cpu(data->dev);
> +       dt_idle_detach_cpu(data->dev);
>         psci_cpuidle_use_cpuhp = false;
>  }
>
> diff --git a/drivers/cpuidle/cpuidle-psci.h b/drivers/cpuidle/cpuidle-psci.h
> index 4e132640ed64..ef004ec7a7c5 100644
> --- a/drivers/cpuidle/cpuidle-psci.h
> +++ b/drivers/cpuidle/cpuidle-psci.h
> @@ -3,29 +3,9 @@
>  #ifndef __CPUIDLE_PSCI_H
>  #define __CPUIDLE_PSCI_H
>
> -struct device;
>  struct device_node;
>
>  void psci_set_domain_state(u32 state);
>  int psci_dt_parse_state_node(struct device_node *np, u32 *state);
>
> -#ifdef CONFIG_ARM_PSCI_CPUIDLE_DOMAIN
> -
> -#include "dt_idle_genpd.h"
> -
> -static inline struct device *psci_dt_attach_cpu(int cpu)
> -{
> -       return dt_idle_attach_cpu(cpu, "psci");
> -}
> -
> -static inline void psci_dt_detach_cpu(struct device *dev)
> -{
> -       dt_idle_detach_cpu(dev);
> -}
> -
> -#else
> -static inline struct device *psci_dt_attach_cpu(int cpu) { return NULL; }
> -static inline void psci_dt_detach_cpu(struct device *dev) { }
> -#endif
> -
>  #endif /* __CPUIDLE_PSCI_H */
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index b88af1262f1a..2b47811d986f 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -20,6 +20,7 @@ 
 #include <linux/string.h>
 
 #include "cpuidle-psci.h"
+#include "dt_idle_genpd.h"
 
 struct psci_pd_provider {
 	struct list_head link;
diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index bf68920d038a..782030a27703 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -28,6 +28,7 @@ 
 
 #include "cpuidle-psci.h"
 #include "dt_idle_states.h"
+#include "dt_idle_genpd.h"
 
 struct psci_cpuidle_data {
 	u32 *psci_states;
@@ -224,7 +225,7 @@  static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
 	if (IS_ENABLED(CONFIG_PREEMPT_RT))
 		return 0;
 
-	data->dev = psci_dt_attach_cpu(cpu);
+	data->dev = dt_idle_attach_cpu(cpu, "psci");
 	if (IS_ERR_OR_NULL(data->dev))
 		return PTR_ERR_OR_ZERO(data->dev);
 
@@ -311,7 +312,7 @@  static void psci_cpu_deinit_idle(int cpu)
 {
 	struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu);
 
-	psci_dt_detach_cpu(data->dev);
+	dt_idle_detach_cpu(data->dev);
 	psci_cpuidle_use_cpuhp = false;
 }
 
diff --git a/drivers/cpuidle/cpuidle-psci.h b/drivers/cpuidle/cpuidle-psci.h
index 4e132640ed64..ef004ec7a7c5 100644
--- a/drivers/cpuidle/cpuidle-psci.h
+++ b/drivers/cpuidle/cpuidle-psci.h
@@ -3,29 +3,9 @@ 
 #ifndef __CPUIDLE_PSCI_H
 #define __CPUIDLE_PSCI_H
 
-struct device;
 struct device_node;
 
 void psci_set_domain_state(u32 state);
 int psci_dt_parse_state_node(struct device_node *np, u32 *state);
 
-#ifdef CONFIG_ARM_PSCI_CPUIDLE_DOMAIN
-
-#include "dt_idle_genpd.h"
-
-static inline struct device *psci_dt_attach_cpu(int cpu)
-{
-	return dt_idle_attach_cpu(cpu, "psci");
-}
-
-static inline void psci_dt_detach_cpu(struct device *dev)
-{
-	dt_idle_detach_cpu(dev);
-}
-
-#else
-static inline struct device *psci_dt_attach_cpu(int cpu) { return NULL; }
-static inline void psci_dt_detach_cpu(struct device *dev) { }
-#endif
-
 #endif /* __CPUIDLE_PSCI_H */