From patchwork Thu Nov 20 02:55:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 739 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=1763607420; bh=blSPgfo1kq4EMj8Fpbx9dQvd0EK1fC3MQFzMWHs276U=; 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=G0jDywZoewPnUPHpe7ZcGvOqMFBz6tU7U03JBjP9GKQSjK3oaJi+9B1SRtlMnTakk pppIlotdnrn7TOErd7LoWE7tI8PKe64DeV7pyqfEEqNzeNHBCeb9/+RSa/YGZn142W ggvMzCRHPsaTSh3nfsdgQdRnn6p9dzKVgBDjYVQ4KTMUFNFDgGqJ1hoAftBYLNL5EX QpdxdRa5JwHN76k13/UWmKb82EycVfk8O+iJWGKQ/53XP8Zwe4nZgW1EnzvmMajxoQ fnYmtXlUDtgRqWr3fDB3gX7AqoBELSzxu7AtoRRCy7mdT2ZKH6aGTaJkkni/ZvmfEo r4DsLq5oDzOMA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AD6C8686C8 for ; Wed, 19 Nov 2025 19:57:00 -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 wCC9EZtTl0NN for ; Wed, 19 Nov 2025 19:57:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607420; bh=blSPgfo1kq4EMj8Fpbx9dQvd0EK1fC3MQFzMWHs276U=; 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=G0jDywZoewPnUPHpe7ZcGvOqMFBz6tU7U03JBjP9GKQSjK3oaJi+9B1SRtlMnTakk pppIlotdnrn7TOErd7LoWE7tI8PKe64DeV7pyqfEEqNzeNHBCeb9/+RSa/YGZn142W ggvMzCRHPsaTSh3nfsdgQdRnn6p9dzKVgBDjYVQ4KTMUFNFDgGqJ1hoAftBYLNL5EX QpdxdRa5JwHN76k13/UWmKb82EycVfk8O+iJWGKQ/53XP8Zwe4nZgW1EnzvmMajxoQ fnYmtXlUDtgRqWr3fDB3gX7AqoBELSzxu7AtoRRCy7mdT2ZKH6aGTaJkkni/ZvmfEo r4DsLq5oDzOMA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9A3B768668 for ; Wed, 19 Nov 2025 19:57:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607418; bh=GOWNx/sJa8UqXtA/3wR6P5grI5SxAp7wedGWpK0hhMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hQX54Y8K2T4jbq2ZesaKZ/7PkixJ5bZBKXrSTcVVENOs3Gl/RBk6VfE5TCflA7E/i zSXri1PjisAw0feepgPxmdxVISdV4Ss+ITge0SJnVCt2Wdv2XsE1HrbLczUhpOmt1r K5QIVV61Mer8eyGSwrGr0Y5t+3dfPnM5JhVmu/VHtGYFz+hDYp33GpXAQ0MvMjWkCl fqDWa/FGXYAuoxIinybNMo6FBDWEoJwvrmOy3t9W3CpENFerVkcoaHOtklLunsfOij IqI8W118Qecwlx0FlbwbHd0c4zM/vQSqDC7p2ShQPBMh6BwkJfwf011lFMKFTFS7bl 7tmdGr0TGOBPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9209C68631; Wed, 19 Nov 2025 19:56:58 -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 DOBqHM_9WyxJ; Wed, 19 Nov 2025 19:56:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607414; bh=YeyZO2c2/J9Kq7SDLAv+DWrRuhDEfTpiY0Yod8p/WdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uVQhu7nFxkrnEXGWTSb0VICVoGo4vAHJClBJrpv9vL6Fy8Zbpk3gTnZOOXnydG/3r yGXChD5A1KG+nl8jC40OCtxP38wuzYZ2Mqun6n5U6Cl4wIDmihfZWbIRZlaEmwp5wm e4p2uwB6jfsQ8hSVv5g6W8EreJ69Q1zZJjhl8wmIA+sPpQskQLKUwG5zT1wZBQ7e8t qn1AQ5gnIVPRm81FIbGCUo8Mh5L74fc44pDej+q5RZ11eekS65T4+JTIqwOUQEKlvR xvD6cfDTo46HAnQnddmpl3DuSEEOLt0GcxdlWapAwLwG8pXTbE/WqP4zZ/LLQIjppO SzoJXwX3Noq5w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3951C68614; Wed, 19 Nov 2025 19:56:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 19 Nov 2025 19:55:46 -0700 Message-ID: <20251120025614.2215587-12-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: GGZGQXFTEEAFXLO33I6RRA7B7UKZQIKD X-Message-ID-Hash: GGZGQXFTEEAFXLO33I6RRA7B7UKZQIKD 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 11/30] fit: Refactor fit_print_contents() to use new fit_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 Create a new fit_print() function containing the logic from fit_print_contents(), and make fit_print_contents() call it. This allows future callers to use fit_print() directly as we add more features. Tidy up the function comments so that they are in the header. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/image-fit.c | 34 ++++++---------------------------- include/image.h | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/boot/image-fit.c b/boot/image-fit.c index eb47c00cc01..9103016bd08 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -368,19 +368,7 @@ static void fit_conf_print(const void *fit, int noffset, const char *p) } } -/** - * fit_print_contents - prints out the contents of the FIT format image - * @fit: pointer to the FIT format image header - * @p: pointer to prefix string - * - * fit_print_contents() formats a multi line FIT image contents description. - * The routine prints out FIT image properties (root node level) followed by - * the details of each component image. - * - * returns: - * no returned results - */ -void fit_print_contents(const void *fit) +void fit_print(const void *fit) { const char *desc; char *uname; @@ -472,21 +460,11 @@ void fit_print_contents(const void *fit) } } -/** - * fit_image_print - prints out the FIT component image details - * @fit: pointer to the FIT format image header - * @image_noffset: offset of the component image node - * @p: pointer to prefix string - * - * fit_image_print() lists all mandatory properties for the processed component - * image. If present, hash nodes are printed out as well. Load - * address for images of type firmware is also printed out. Since the load - * address is not mandatory for firmware images, it will be output as - * "unavailable" when not present. - * - * returns: - * no returned results - */ +void fit_print_contents(const void *fit) +{ + fit_print(fit); +} + void fit_image_print(const void *fit, int image_noffset, const char *p) { uint8_t type, arch, os, comp = IH_COMP_NONE; diff --git a/include/image.h b/include/image.h index 33eb5d71e79..2f9469e2709 100644 --- a/include/image.h +++ b/include/image.h @@ -1198,9 +1198,52 @@ int fit_parse_subimage(const char *spec, ulong addr_curr, ulong *addr, const char **image_name); int fit_get_subimage_count(const void *fit, int images_noffset); -void fit_print_contents(const void *fit); + +/** + * fit_print() - prints out the contents of the FIT format image + * @fit: pointer to the FIT format image header + * @p: pointer to prefix string + * + * This formats a multi line FIT image contents description. + * The routine prints out FIT image properties (root node level) followed by + * the details of each component image. + * + * returns: + * no returned results + */ +void fit_print(const void *fit); + +/** + * fit_image_print - prints out the FIT component image details + * @fit: pointer to the FIT format image header + * @image_noffset: offset of the component image node + * @p: pointer to prefix string + * + * fit_image_print() lists all mandatory properties for the processed component + * image. If present, hash nodes are printed out as well. Load + * address for images of type firmware is also printed out. Since the load + * address is not mandatory for firmware images, it will be output as + * "unavailable" when not present. + * + * returns: + * no returned results + */ void fit_image_print(const void *fit, int noffset, const char *p); +/** + * fit_print_contents() - prints out the contents of the FIT format image + * @fit: pointer to the FIT format image header + * @p: pointer to prefix string + * + * This formats a multi line FIT image contents description. + * The routine prints out FIT image properties (root node level) followed by + * the details of each component image. + * + * returns: + * no returned results + */ +void fit_print_contents(const void *fit); + /** * fit_get_end - get FIT image size * @fit: pointer to the FIT format image header