From cc6ef3d1fdde75ca4783f2d98d194b4a2c35d848 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 14 Jul 2021 14:53:22 +0200 Subject: [PATCH] of: kexec: Remove FDT_PROP_* definitions The FDT_PROP_* definitions make it harder to follow the code. Remove them, and use the actual string literals instead. Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/af415c86cd2ba9c8a6bb2eaaf56c3198a24b23d3.1626267092.git.geert+renesas@glider.be Signed-off-by: Rob Herring --- drivers/of/kexec.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c index f335d941a716..761fd870d1db 100644 --- a/drivers/of/kexec.c +++ b/drivers/of/kexec.c @@ -18,14 +18,6 @@ #include #include -/* relevant device tree properties */ -#define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr" -#define FDT_PROP_MEM_RANGE "linux,usable-memory-range" -#define FDT_PROP_INITRD_START "linux,initrd-start" -#define FDT_PROP_INITRD_END "linux,initrd-end" -#define FDT_PROP_BOOTARGS "bootargs" -#define FDT_PROP_KASLR_SEED "kaslr-seed" -#define FDT_PROP_RNG_SEED "rng-seed" #define RNG_SEED_SIZE 128 /* @@ -310,10 +302,10 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, goto out; } - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KEXEC_ELFHDR); + ret = fdt_delprop(fdt, chosen_node, "linux,elfcorehdr"); if (ret && ret != -FDT_ERR_NOTFOUND) goto out; - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_MEM_RANGE); + ret = fdt_delprop(fdt, chosen_node, "linux,usable-memory-range"); if (ret && ret != -FDT_ERR_NOTFOUND) goto out; @@ -347,12 +339,12 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, /* add initrd-* */ if (initrd_load_addr) { - ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_START, + ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-start", initrd_load_addr); if (ret) goto out; - ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_END, + ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end", initrd_load_addr + initrd_len); if (ret) goto out; @@ -362,11 +354,11 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, goto out; } else { - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_START); + ret = fdt_delprop(fdt, chosen_node, "linux,initrd-start"); if (ret && (ret != -FDT_ERR_NOTFOUND)) goto out; - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_END); + ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end"); if (ret && (ret != -FDT_ERR_NOTFOUND)) goto out; } @@ -374,8 +366,7 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, if (image->type == KEXEC_TYPE_CRASH) { /* add linux,elfcorehdr */ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, - FDT_PROP_KEXEC_ELFHDR, - image->elf_load_addr, + "linux,elfcorehdr", image->elf_load_addr, image->elf_headers_sz); if (ret) goto out; @@ -391,8 +382,7 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, /* add linux,usable-memory-range */ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, - FDT_PROP_MEM_RANGE, - crashk_res.start, + "linux,usable-memory-range", crashk_res.start, crashk_res.end - crashk_res.start + 1); if (ret) goto out; @@ -400,17 +390,17 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, /* add bootargs */ if (cmdline) { - ret = fdt_setprop_string(fdt, chosen_node, FDT_PROP_BOOTARGS, cmdline); + ret = fdt_setprop_string(fdt, chosen_node, "bootargs", cmdline); if (ret) goto out; } else { - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_BOOTARGS); + ret = fdt_delprop(fdt, chosen_node, "bootargs"); if (ret && (ret != -FDT_ERR_NOTFOUND)) goto out; } /* add kaslr-seed */ - ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KASLR_SEED); + ret = fdt_delprop(fdt, chosen_node, "kaslr-seed"); if (ret == -FDT_ERR_NOTFOUND) ret = 0; else if (ret) @@ -419,26 +409,26 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, if (rng_is_initialized()) { u64 seed = get_random_u64(); - ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_KASLR_SEED, seed); + ret = fdt_setprop_u64(fdt, chosen_node, "kaslr-seed", seed); if (ret) goto out; } else { pr_notice("RNG is not initialised: omitting \"%s\" property\n", - FDT_PROP_KASLR_SEED); + "kaslr-seed"); } /* add rng-seed */ if (rng_is_initialized()) { void *rng_seed; - ret = fdt_setprop_placeholder(fdt, chosen_node, FDT_PROP_RNG_SEED, + ret = fdt_setprop_placeholder(fdt, chosen_node, "rng-seed", RNG_SEED_SIZE, &rng_seed); if (ret) goto out; get_random_bytes(rng_seed, RNG_SEED_SIZE); } else { pr_notice("RNG is not initialised: omitting \"%s\" property\n", - FDT_PROP_RNG_SEED); + "rng-seed"); } ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0);