x86: dt: Use of_get_cpu_hwid()
authorRob Herring <robh@kernel.org>
Wed, 6 Oct 2021 16:43:30 +0000 (11:43 -0500)
committerRob Herring <robh@kernel.org>
Wed, 20 Oct 2021 18:37:24 +0000 (13:37 -0500)
Replace open coded parsing of CPU nodes' 'reg' property with
of_get_cpu_hwid().

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211006164332.1981454-11-robh@kernel.org
arch/x86/kernel/devicetree.c

index 6a4cb71..3aa1e99 100644 (file)
@@ -139,12 +139,11 @@ static void __init dtb_cpu_setup(void)
 {
        struct device_node *dn;
        u32 apic_id, version;
-       int ret;
 
        version = GET_APIC_VERSION(apic_read(APIC_LVR));
        for_each_of_cpu_node(dn) {
-               ret = of_property_read_u32(dn, "reg", &apic_id);
-               if (ret < 0) {
+               apic_id = of_get_cpu_hwid(dn, 0);
+               if (apic_id == ~0U) {
                        pr_warn("%pOF: missing local APIC ID\n", dn);
                        continue;
                }