From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH v2 05/13] ARM: psci: client: add PSCI version/method parameters
Date: Wed, 13 Aug 2025 16:33:37 +0200 [thread overview]
Message-ID: <20250813143345.3758653-6-a.fatoum@barebox.org> (raw)
In-Reply-To: <20250813143345.3758653-1-a.fatoum@barebox.org>
Populate device parameters with this information, so the bfetch command
can make use of it.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- use IS_ERR_OR_NULL to guard param getting
- use new get_param_value helper
---
arch/arm/cpu/psci-client.c | 17 +++++++++++++----
include/param.h | 10 ++++++++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 4c26beacb9bb..75cc3f59e0c1 100644
--- a/arch/arm/cpu/psci-client.c
+++ b/arch/arm/cpu/psci-client.c
@@ -117,6 +117,7 @@ static int of_psci_do_fixup(struct device_node *root, void *method)
static int __init psci_probe(struct device *dev)
{
+ struct param_d *param;
const char *method;
ulong of_version, actual_version;
int ret;
@@ -154,8 +155,12 @@ static int __init psci_probe(struct device *dev)
psci_invoke(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, &actual_version);
version = actual_version;
- dev_info(dev, "detected version %u.%u\n",
- version >> 16, version & 0xffff);
+ param = dev_add_param_fixed(dev, "version", "%u.%u",
+ version >> 16, version & 0xffff);
+ if (!IS_ERR_OR_NULL(param))
+ dev_info(dev, "detected version %s\n", get_param_value(param));
+
+ dev_add_param_fixed(dev, "method", "%s", method);
if (actual_version != of_version)
of_register_fixup(of_psci_do_fixup, (void *)method);
@@ -170,11 +175,15 @@ static int __init psci_probe(struct device *dev)
restart.priority = 400;
ret = restart_handler_register(&restart);
- if (ret)
+ if (ret) {
dev_warn(dev, "error registering restart handler: %pe\n",
ERR_PTR(ret));
+ return ret;
+ }
- return ret;
+ dev_add_alias(dev, "psci");
+
+ return 0;
}
static __maybe_unused struct of_device_id psci_dt_ids[] = {
diff --git a/include/param.h b/include/param.h
index 1bf04015f266..c12151134752 100644
--- a/include/param.h
+++ b/include/param.h
@@ -253,6 +253,16 @@ static inline int bobject_param_set_generic(bobject_t bobj, struct param_d *p,
}
#endif
+static inline const char *get_param_value(struct param_d *param)
+{
+ if (!IS_ENABLED(CONFIG_PARAMETER))
+ return NULL;
+ if (IS_ERR_OR_NULL(param))
+ return ERR_CAST(param);
+
+ return param->get(param->bobj, param);
+}
+
int param_set_readonly(struct param_d *p, void *priv);
/*
--
2.39.5
next prev parent reply other threads:[~2025-08-13 14:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 01/13] common: introduce structured I/O Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 02/13] ARM: cpuinfo: support structio output Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 03/13] commands: uptime: enable structured I/O Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 04/13] string: implement strv_length helper Ahmad Fatoum
2025-08-13 14:33 ` Ahmad Fatoum [this message]
2025-08-13 14:33 ` [PATCH v2 06/13] net: move netmask_to_prefix into header Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 07/13] optee: add revision info to tee devinfo output Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 08/13] tee: enable structured I/O in devinfo handler Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 09/13] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 10/13] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 11/13] commands: introduce bfetch command Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 12/13] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 13/13] hush: structio: silence missing command error message Ahmad Fatoum
2025-08-14 10:53 ` [PATCH v2 00/13] commands: add bfetch/buds of command redirection Sascha Hauer
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=20250813143345.3758653-6-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/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