Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp364077pxv; Wed, 14 Jul 2021 05:56:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVf1jwIs3sw+X7a2HvzNZnF2jMybC61Fc8TO88F/qp74gB2/YF4hnAY0N1K5n6fu3QFkNj X-Received: by 2002:a17:907:2d8a:: with SMTP id gt10mr12455810ejc.10.1626267400980; Wed, 14 Jul 2021 05:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626267400; cv=none; d=google.com; s=arc-20160816; b=rQk4tBxNyhwKUxSgQ4cw1KpoO1Qc7OJi8YpXtJ72X+x13czz+jtgkoQH+zelz7V6T0 5jm3BkCqOomr/mh4ZP3+oDTC30nkRfUtS6ldda4Mzvw74iZdWXmWy5hLjm+uOdAKbUoc wocP2vwtMaRugoQgTDTmizK58HaTvI3UfwV1WZ7CyH0j2XGV33TQL44YDyVlpZKFpCdX PtgKi2+LuWE3uRIJoG5WbE0P/K/CyNc18p9qtePkGtN8s9Ng1JsdCm3AVNLJB+yYJKWo Au8/B1H29L5Cc9HAZNrBvORhCDkjTTff/8LpX1O38FblcJit4D+Vmu5IL3Dj/sunx+zN RJtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3mD/V/WPg7PQhQuyhGvlp2S9mHzHtZ1Wq+Y4o1DKWYQ=; b=urF1buviadcKLJ/8qWLgLaUV0oD6h8EQUWRKcujJKmtae5g7ANuajKsj1NNECCBKgk PWanukcfSYG08oNwiquiEOtfNOwe5vDUDaePP8FPVhpMvnuKMLKHNMVrF79PA+AY5Mmc 0AaQext8WdOwnzumKTvfQu2jzNdNKGOGVGyDUYSSAWB8+C2XoZ5V6G/XHQXBv5FRaXXD vzXnPMcxQSFkS+mXg8WGi482EAab7S9WXu7Ie3i+ZANcKHZnlN7jqQeHMXTkHDcVeYOV FMEYTS4T7a9mSWgPco3HhHq7N9rk6YOd3Y2fna+e1Nwjz8qPLaOh0rrajoXhNA36xTrE OYRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si2874856ejs.626.2021.07.14.05.56.17; Wed, 14 Jul 2021 05:56:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239372AbhGNM4R (ORCPT + 99 others); Wed, 14 Jul 2021 08:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239337AbhGNM4R (ORCPT ); Wed, 14 Jul 2021 08:56:17 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA5BC06175F for ; Wed, 14 Jul 2021 05:53:25 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed10:39cc:190a:2775:cfe7]) by andre.telenet-ops.be with bizsmtp id V0tP2500K1ccfby010tPVP; Wed, 14 Jul 2021 14:53:23 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m3eOB-0018jI-K7; Wed, 14 Jul 2021 14:53:23 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1m3eOB-00AaR3-8A; Wed, 14 Jul 2021 14:53:23 +0200 From: Geert Uytterhoeven To: Rob Herring , Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] of: kexec: Remove FDT_PROP_* definitions Date: Wed, 14 Jul 2021 14:53:22 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- This is v2 of "of: kexec: Always use FDT_PROP_INITRD_START and FDT_PROP_INITRD_END". https://lore.kernel.org/r/a4e07a0c1efea913ce5a61136162b5b720b96b48.1623835273.git.geert+renesas@glider.be/ v2: - Invert direction, as requested by Rob. --- 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 f335d941a716e841..761fd870d1db277f 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); -- 2.25.1