public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] drivers/firmware/psci: Hide ACPI state during initialization
@ 2020-02-02 23:06 Gavin Shan
  2020-02-03 11:45 ` Sudeep Holla
  2020-02-11  2:02 ` Gavin Shan
  0 siblings, 2 replies; 5+ messages in thread
From: Gavin Shan @ 2020-02-02 23:06 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: mark.rutland, lorenzo.pieralisi, sudeep.holla

Either psci_dt_init() or psci_acpi_init() s called depends on ACPI
enablement state, which isn't so nice. In this case, two functions
have to be exported from PSCI module.

This hides the ACPI enablement state insides PSCI module so that we
only need to export a function, to make the code a bit simplified.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 arch/arm64/kernel/setup.c    |  7 +------
 drivers/firmware/psci/psci.c | 20 +++++++++++++++++---
 include/linux/psci.h         |  8 +++-----
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index a34890bf309f..9fce20bec720 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -338,12 +338,7 @@ void __init setup_arch(char **cmdline_p)
 	request_standard_resources();
 
 	early_ioremap_reset();
-
-	if (acpi_disabled)
-		psci_dt_init();
-	else
-		psci_acpi_init();
-
+	psci_init();
 	cpu_read_bootcpu_ops();
 	smp_init_cpus();
 	smp_build_mpidr_hash();
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index b3b6c15e7b36..f2f5db35d896 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -557,7 +557,7 @@ static const struct of_device_id psci_of_match[] __initconst = {
 	{},
 };
 
-int __init psci_dt_init(void)
+static int __init psci_dt_init(void)
 {
 	struct device_node *np;
 	const struct of_device_id *matched_np;
@@ -581,7 +581,7 @@ int __init psci_dt_init(void)
  * We use PSCI 0.2+ when ACPI is deployed on ARM64 and it's
  * explicitly clarified in SBBR
  */
-int __init psci_acpi_init(void)
+static int __init psci_acpi_init(void)
 {
 	if (!acpi_psci_present()) {
 		pr_info("is not implemented in ACPI.\n");
@@ -597,4 +597,18 @@ int __init psci_acpi_init(void)
 
 	return psci_probe();
 }
-#endif
+
+#else
+static inline int psci_acpi_init(void)
+{
+	return 0;
+}
+#endif /* CONFIG_ACPI */
+
+int __init psci_init(void)
+{
+	if (acpi_disabled)
+		return psci_dt_init();
+
+	return psci_acpi_init();
+}
diff --git a/include/linux/psci.h b/include/linux/psci.h
index ebe0a881d13d..64af884a8d96 100644
--- a/include/linux/psci.h
+++ b/include/linux/psci.h
@@ -39,18 +39,16 @@ struct psci_operations {
 
 extern struct psci_operations psci_ops;
 
-#if defined(CONFIG_ARM_PSCI_FW)
-int __init psci_dt_init(void);
+#ifdef CONFIG_ARM_PSCI_FW
+int __init psci_init(void);
 #else
-static inline int psci_dt_init(void) { return 0; }
+static inline int psci_init(void) { return 0; }
 #endif
 
 #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
-int __init psci_acpi_init(void);
 bool __init acpi_psci_present(void);
 bool acpi_psci_use_hvc(void);
 #else
-static inline int psci_acpi_init(void) { return 0; }
 static inline bool acpi_psci_present(void) { return false; }
 static inline bool acpi_psci_use_hvc(void) {return false; }
 #endif
-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-11 23:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-02 23:06 [PATCH] drivers/firmware/psci: Hide ACPI state during initialization Gavin Shan
2020-02-03 11:45 ` Sudeep Holla
2020-02-11  2:02 ` Gavin Shan
2020-02-11 12:21   ` Lorenzo Pieralisi
2020-02-11 23:14     ` Gavin Shan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox