Populate device parameters with this information, so the bfetch command
can make use of it.

Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org>
---
 arch/arm/cpu/psci-client.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 4c26beacb9bb..1284a408d118 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(param))
+               dev_info(dev, "detected version %s\n", param->get(dev, 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[] = {
-- 
2.39.5


Reply via email to