From patchwork Thu Nov 20 02:55:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 745 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607435; bh=izSKvO2ys9a1RZjxFrslbHfqy6rq8UlULHppaqGGHss=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=msNcQXbC5HWQxhtcORys6gY+ELKdStgsMkIhcPkY5pmDYSpGTD5A1LBid+eICnGp5 Kh8UFT/wHpU4WGW+zi4q8lBl20KkJrazXQcK6z3ME8mtZVLoqDt2PmRECOqDogNBcI kORXmMxP2+RrPAi5LTktY7Lp2o58vpxKZnWnbnhCV9jQOLQTPt3ter1SMPdgWwkKMR JD23BIHQHAQy/6Cz52jOrOxAX5WCTXpgef3t6ZxH3slMnQSnnzOMUGv4OWLv4H5500 xe+kI0xr1gxpk0sOGAWtuDRM+LaDoreGHO0g5R+ZNndfrTq61LbqsCT0pvu6BiX0mD HWaA4yXcoWxZA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C1C53686C9 for ; Wed, 19 Nov 2025 19:57:15 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id czYLKDWh6CUC for ; Wed, 19 Nov 2025 19:57:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607433; bh=izSKvO2ys9a1RZjxFrslbHfqy6rq8UlULHppaqGGHss=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=SiOMNrL2gTvceHqSz97ZqQRYZfjcXRM21AX5FOYo3LPQVT/J6T22rOL8s1W4Axd6r UocB2OjMy6oXSEPW5Gakdf2orPi0N5iEzh4Vbs334TyVQzyK/vXn3kZ0r2e5thMCym fgFIOs55VwzsApW1lljUZ1yVo9rVJkBu+1G3fNmVheCanEiReEMrbnQrut8Qm8ysJz ENHgnvDGTGBq3bowsbDjZl71kiIMSl2Cm5aR63LvDstsQmvOxQyRwZahL7xvB/OSv3 VVN/cibHslcEyA0Zi5RYpGD3+jNi/mNy991eXTbeoaT5qZVkQ0UDitLju1mUNyOUYy Yt14ce+1cD5ew== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BF23768631 for ; Wed, 19 Nov 2025 19:57:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607429; bh=CrfWacoUzTkXu2koLVufn2U0V0cYhT+wW0lmmoX7wW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lf1MBKsf9uMErGXhy1jHHazziuIfW00tkiOl1KAWSgRCyYERAnLLYXvcz7AMD7+Cf AIocge91BnEvHjT9xKLBKnUGrqt74cr7UaL0OG/9edYKisPVk5rJ8Tm0dg02ILgjhF 8zzPIzfvk0uSxDun4uPvBvppiNjzKNiV759trPWo5K46oS32R79bgSLsHCnVGzYfhk hBhHc8vll4KGqfAVZVGqNHxJpzcTUqCU2xTJQYfc74jP5BKTtloM0wPdPcyWRiMWkD 3P/oYktPONZv3QaCuqTb8gxC1EWKpglA+R/1LlZhHzlzQXItoaMAoO+//xERiVHnTo tXwj2zvolWFkg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 79DAC5E7DA; Wed, 19 Nov 2025 19:57:09 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id bzk1AWAlB3vY; Wed, 19 Nov 2025 19:57:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607428; bh=cYJXQBHp7t2VvSAhiI8iGGIGhqo5OvGNwyGMkGuea0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rhHeBmRvsX95nNiPVN8m9KL77ZUU/MrP2ydZ78jisx/HsblYdlFHze1jdm+DhhACY W4gpAnQZNHA7EUYKauUTF79Mq09yHYG/bRYJQZL6i9Mz4WNfOAsBWt7EtxOEm7ZGLR 9LtR7MCiispThvUpeyjLkNhhbL24uvY/OoRR7dnq+17lUv0jFGKe3VACqpVPQezRr3 IPYDt7D/2jwtibvy2fZhMVaWEn//5n4y9jFdwXjxvS3YgV8IGRW3TJzCLIGvcuTi8X DLejlutQuNiORdLSMz272y4T+ZjowjgkokCZltqHqGWIsnrdvZZIFaQnjxST3LtmHz rvejqtSyYVz3A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3522468654; Wed, 19 Nov 2025 19:57:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 19 Nov 2025 19:55:52 -0700 Message-ID: <20251120025614.2215587-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120025614.2215587-1-sjg@u-boot.org> References: <20251120025614.2215587-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PCNVE7F2FKV7EBLFNEDVL5KIVRXQJE6M X-Message-ID-Hash: PCNVE7F2FKV7EBLFNEDVL5KIVRXQJE6M X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 17/30] fit: Use emit_label() helper in fit_image_print() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Update fit_image_print() to use the emit_label() helper function for printing labels. This avoids various manual printf() calls and spacing logic. Set ctx->tab to 19 to align values at the correct column position. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/fit_print.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/boot/fit_print.c b/boot/fit_print.c index b87526023b4..69139c46931 100644 --- a/boot/fit_print.c +++ b/boot/fit_print.c @@ -184,7 +184,6 @@ static void fit_image_print_verification_data(struct fit_print_ctx *ctx, void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) { const void *fit = ctx->fit; - const char *p = ctx->indent; uint8_t type, arch, os, comp = IH_COMP_NONE; const char *desc; size_t size; @@ -196,7 +195,7 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) /* Mandatory properties */ ret = fit_get_desc(fit, image_noffset, &desc); - printf("%s Description: ", p); + emit_label(ctx, "Description"); if (ret) printf("unavailable\n"); else @@ -206,7 +205,7 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) time_t timestamp; ret = fit_get_timestamp(fit, 0, ×tamp); - printf("%s Created: ", p); + emit_label(ctx, "Created"); if (ret) printf("unavailable\n"); else @@ -214,15 +213,17 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) } fit_image_get_type(fit, image_noffset, &type); - printf("%s Type: %s\n", p, genimg_get_type_name(type)); + emit_label(ctx, "Type"); + printf("%s\n", genimg_get_type_name(type)); fit_image_get_comp(fit, image_noffset, &comp); - printf("%s Compression: %s\n", p, genimg_get_comp_name(comp)); + emit_label(ctx, "Compression"); + printf("%s\n", genimg_get_comp_name(comp)); ret = fit_image_get_data(fit, image_noffset, &data, &size); if (!tools_build()) { - printf("%s Data Start: ", p); + emit_label(ctx, "Data Start"); if (ret) { printf("unavailable\n"); } else { @@ -232,7 +233,7 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) } } - printf("%s Data Size: ", p); + emit_label(ctx, "Data Size"); if (ret) printf("unavailable\n"); else @@ -243,20 +244,22 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) type == IH_TYPE_RAMDISK || type == IH_TYPE_FIRMWARE || type == IH_TYPE_FLATDT) { fit_image_get_arch(fit, image_noffset, &arch); - printf("%s Architecture: %s\n", p, genimg_get_arch_name(arch)); + emit_label(ctx, "Architecture"); + printf("%s\n", genimg_get_arch_name(arch)); } if (type == IH_TYPE_KERNEL || type == IH_TYPE_RAMDISK || type == IH_TYPE_FIRMWARE) { fit_image_get_os(fit, image_noffset, &os); - printf("%s OS: %s\n", p, genimg_get_os_name(os)); + emit_label(ctx, "OS"); + printf("%s\n", genimg_get_os_name(os)); } if (type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || type == IH_TYPE_FIRMWARE || type == IH_TYPE_RAMDISK || type == IH_TYPE_FPGA) { ret = fit_image_get_load(fit, image_noffset, &load); - printf("%s Load Address: ", p); + emit_label(ctx, "Load Address"); if (ret) printf("unavailable\n"); else @@ -265,13 +268,15 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) /* optional load address for FDT */ if (type == IH_TYPE_FLATDT && - !fit_image_get_load(fit, image_noffset, &load)) - printf("%s Load Address: 0x%08lx\n", p, load); + !fit_image_get_load(fit, image_noffset, &load)) { + emit_label(ctx, "Load Address"); + printf("0x%08lx\n", load); + } if (type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || type == IH_TYPE_RAMDISK) { ret = fit_image_get_entry(fit, image_noffset, &entry); - printf("%s Entry Point: ", p); + emit_label(ctx, "Entry Point"); if (ret) printf("unavailable\n"); else