From: Gavin Shan <gshan@redhat.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com
Subject: [PATCH] drivers/firmware/psci: Hide ACPI state during initialization
Date: Mon, 3 Feb 2020 10:06:26 +1100 [thread overview]
Message-ID: <20200202230626.6598-1-gshan@redhat.com> (raw)
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
next reply other threads:[~2020-02-02 23:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-02 23:06 Gavin Shan [this message]
2020-02-03 11:45 ` [PATCH] drivers/firmware/psci: Hide ACPI state during initialization Sudeep Holla
2020-02-11 2:02 ` Gavin Shan
2020-02-11 12:21 ` Lorenzo Pieralisi
2020-02-11 23:14 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200202230626.6598-1-gshan@redhat.com \
--to=gshan@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox