mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP)
Date: Wed,  3 Jan 2024 20:07:24 +0300	[thread overview]
Message-ID: <20240103170725.846378-2-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20240103170725.846378-1-antonynpavlov@gmail.com>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 common/uimage.c | 22 ++++++++++++----------
 fs/uimagefs.c   | 24 ++++++++++--------------
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/common/uimage.c b/common/uimage.c
index 72c37b7d15d..3c9a79d9109 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -29,17 +29,19 @@ static inline int uimage_is_multi_image(struct uimage_handle *handle)
 void uimage_print_contents(struct uimage_handle *handle)
 {
 	struct image_header *hdr = &handle->header;
-#if defined(CONFIG_TIMESTAMP)
-	struct rtc_time tm;
-#endif
+
 	printf("   Image Name:   %.*s\n", IH_NMLEN, hdr->ih_name);
-#if defined(CONFIG_TIMESTAMP)
-	printf("   Created:      ");
-	to_tm(hdr->ih_time, &tm);
-	printf("%4d-%02d-%02d  %2d:%02d:%02d UTC\n",
-			tm.tm_year, tm.tm_mon, tm.tm_mday,
-			tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif
+
+	if (IS_ENABLED(CONFIG_TIMESTAMP)) {
+		struct rtc_time tm;
+
+		printf("   Created:      ");
+		to_tm(hdr->ih_time, &tm);
+		printf("%4d-%02d-%02d  %2d:%02d:%02d UTC\n",
+				tm.tm_year, tm.tm_mon, tm.tm_mday,
+				tm.tm_hour, tm.tm_min, tm.tm_sec);
+	}
+
 #if defined(CONFIG_BOOTM_SHOW_TYPE)
 	printf("   OS:           %s\n", image_get_os_name(hdr->ih_os));
 	printf("   Architecture: %s\n", image_get_arch_name(hdr->ih_arch));
diff --git a/fs/uimagefs.c b/fs/uimagefs.c
index 7af10ca9864..3099f6a1e62 100644
--- a/fs/uimagefs.c
+++ b/fs/uimagefs.c
@@ -300,28 +300,24 @@ static int uimagefs_add_data_entry(struct uimagefs_handle *priv, size_t offset,
 	return 0;
 }
 
-#if defined(CONFIG_TIMESTAMP)
 static int uimagefs_add_time(struct uimagefs_handle *priv)
 {
 	struct image_header *header = &priv->header;
-	struct rtc_time tm;
-	char *val;
 
-	to_tm(header->ih_time, &tm);
-	val = basprintf("%4d-%02d-%02d  %2d:%02d:%02d UTC",
-			tm.tm_year, tm.tm_mon, tm.tm_mday,
-			tm.tm_hour, tm.tm_min, tm.tm_sec);
+	if (IS_ENABLED(CONFIG_TIMESTAMP)) {
+		struct rtc_time tm;
+		char *val;
 
-	return uimagefs_add_str(priv, UIMAGEFS_TIME, val);
-}
-#else
-static int uimagefs_add_time(struct uimagefs_handle *priv)
-{
-	struct image_header *header = &priv->header;
+		to_tm(header->ih_time, &tm);
+		val = basprintf("%4d-%02d-%02d  %2d:%02d:%02d UTC",
+				tm.tm_year, tm.tm_mon, tm.tm_mday,
+				tm.tm_hour, tm.tm_min, tm.tm_sec);
+
+		return uimagefs_add_str(priv, UIMAGEFS_TIME, val);
+	}
 
 	return uimagefs_add_hex(priv, UIMAGEFS_TIME, header->ih_time);
 }
-#endif
 
 static int uimagefs_add_os(struct uimagefs_handle *priv)
 {
-- 
2.39.0




  reply	other threads:[~2024-01-03 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 17:07 [PATCH 0/2] uImage fixes Antony Pavlov
2024-01-03 17:07 ` Antony Pavlov [this message]
2024-01-03 17:07 ` [PATCH 2/2] common: Kconfig: TIMESTAMP: fix help Antony Pavlov
2024-01-04 11:19 ` [PATCH 0/2] uImage fixes Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240103170725.846378-2-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox