We currently only register the device tree fixup if PSCI version in
device tree disagrees with version read from firmware. The barebox
PSCI DT version may differ from the kernel version though, so we
should rather run the fixup always. If the kernel has already an
up-to-date compatible, it won't change. But for cases where firmware is
expected to fill out the correct PSCI version, barebox will do what's
expected.

While at it, move the of_version logic together to make it easier
to follow.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 arch/arm/cpu/psci-client.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 8e151177c2d7..218170dfa4ba 100644
--- a/arch/arm/cpu/psci-client.c
+++ b/arch/arm/cpu/psci-client.c
@@ -119,10 +119,6 @@ static int __init psci_probe(struct device_d *dev)
        ulong of_version, actual_version;
        int ret;
 
-       ret = dev_get_drvdata(dev, (const void **)&of_version);
-       if (ret)
-               return -ENODEV;
-
        ret = of_property_read_string(dev->device_node, "method", &method);
        if (ret) {
                dev_warn(dev, "missing \"method\" property\n");
@@ -139,6 +135,7 @@ static int __init psci_probe(struct device_d *dev)
        }
 
 
+       of_version = (ulong)device_get_match_data(dev);
        if (of_version < ARM_PSCI_VER(0,2)) {
                version = of_version;
 
@@ -155,8 +152,7 @@ static int __init psci_probe(struct device_d *dev)
        dev_info(dev, "detected version %u.%u\n",
                 version >> 16, version & 0xffff);
 
-       if (actual_version != of_version)
-               of_register_fixup(of_psci_do_fixup, &version);
+       of_register_fixup(of_psci_do_fixup, &version);
 
        ret = poweroff_handler_register_fn(psci_poweroff);
        if (ret)
-- 
2.30.2


Reply via email to