From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 20 Oct 2025 14:28:45 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vAp0H-009tMW-1O for lore@lore.pengutronix.de; Mon, 20 Oct 2025 14:28:45 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vAp0G-0002rF-Pj for lore@pengutronix.de; Mon, 20 Oct 2025 14:28:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kO/mGipdSIEfIBeuxC+bQxkshnTR6k8Xp3XeCSVnFC4=; b=L5WKpGJwSsCjWnQvyzD+crAHWm MBSEZeNI8ZgGtGEuiT742iSJQIU8IWd6vvEhXvbp+M9sCWE2ejo6q1CdHGNUgINeHTDSLDBmDzDYg osHGBSiyxQJvNvjdhNLsrxtWVIRTR+siZ9hcGy6DF1So90lLYdThIeo1yDaVEykhnH9SF6XlGJhOd vdSkVmZyfpSTUbSQf+0JWEEo0b3dmPH2J/l4lO8AymYdhvkx4XVovlwGstNjD8QVMfNtVIpaT9c5n 8rC20WzZwl1p4Hh690e229Y61zlfqub7z4GOXa7F4DrxTfQWydBu1HTC4AjhDH/BgZmg1UCTgpGNN gCY/oBbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vAozf-0000000DPgZ-2Vuf; Mon, 20 Oct 2025 12:28:07 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vAozb-0000000DPe0-47SX for barebox@lists.infradead.org; Mon, 20 Oct 2025 12:28:05 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vAozY-0002Zh-2h for barebox@lists.infradead.org; Mon, 20 Oct 2025 14:28:00 +0200 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vAmBC-004WRD-1k; Mon, 20 Oct 2025 11:27:50 +0200 Received: from mfe by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1vAmBC-007HW5-1R; Mon, 20 Oct 2025 11:27:50 +0200 Date: Mon, 20 Oct 2025 11:27:50 +0200 From: Marco Felsch To: Sascha Hauer Cc: barebox@lists.infradead.org Message-ID: <20251020092750.fwkou7gu4b3nf437@pengutronix.de> References: <20251017120406.1348897-1-m.felsch@pengutronix.de> <20251017120406.1348897-3-m.felsch@pengutronix.de> <20251020084924.6ytubm6byqw22iw3@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251020_052804_045052_B9FE6A72 X-CRM114-Status: GOOD ( 34.74 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-4.1 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: Re: [PATCH 3/4] lib: hexdump: make use of pr_debug X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) On 25-10-20, Sascha Hauer wrote: > On Mon, Oct 20, 2025 at 10:49:24AM +0200, Marco Felsch wrote: > > On 25-10-20, Sascha Hauer wrote: > > > On Fri, Oct 17, 2025 at 02:03:35PM +0200, Marco Felsch wrote: > > > > The hexdump library was ported from Linux which supports different > > > > printk() level. Because the barebox print* facility is different > > > > compared to the one from Linux the barebox printk() doesn't support > > > > levels. Therefore the level is always set to an empty string. > > > > > > > > Furthermore all barebox printk() calls aren't recorded by the internal > > > > barebox_logbuf because they are mostly used for command prints. Linux on > > > > the other hand record each printk() print. > > > > > > > > Not recording the output can be an issue on systems which don't have a > > > > hw-console but a USB-ACM console, because the hexdump call may already > > > > occurred before the console was ready. > > > > > > > > Make use of pr_debug() instead to record the output within the > > > > barebox_logbuf to be available later on via dmesg. Using pr_debug() > > > > should be fine since it is mostly used for debugging/development > > > > purpose. > > > > > > > > Signed-off-by: Marco Felsch > > > > --- > > > > lib/hexdump.c | 9 +++------ > > > > 1 file changed, 3 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/lib/hexdump.c b/lib/hexdump.c > > > > index 940c4eec64e9..ab5e3cf727ec 100644 > > > > --- a/lib/hexdump.c > > > > +++ b/lib/hexdump.c > > > > @@ -284,16 +284,13 @@ void dev_print_hex_dump(struct device *dev, const char *level, > > > > > > > > switch (prefix_type) { > > > > case DUMP_PREFIX_ADDRESS: > > > > - printk("%s%s%s%p: %s\n", level, name, prefix_str, > > > > - ptr + i, linebuf); > > > > + pr_debug("%s%s%p: %s\n", name, prefix_str, ptr + i, linebuf); > > > > > > pr_debug is only compiled in when DEBUG is defined. This means you have > > > to add a "#define DEBUG" in lib/hexdump.c to make the messages visible > > > printed in another file, or alternatively have to define DEBUG globally. > > > > Yep, this is true and I forgot about that drawback :/ > > > > > I think we should rather replace the const char *level argument with a > > > unsigned int level argument expecting one of MSG_* and use pr_print() here. > > > > What about keeping the Linux API but converting it back to int? > > Not possible: > > #define KERN_EMERG "" /* system is unusable */ > #define KERN_ALERT "" /* action must be taken immediately */ > #define KERN_CRIT "" /* critical conditions */ > #define KERN_ERR "" /* error conditions */ > #define KERN_WARNING "" /* warning conditions */ > #define KERN_NOTICE "" /* normal but significant condition */ > #define KERN_INFO "" /* informational */ > #define KERN_DEBUG "" /* debug-level messages */ I should have read my own commit message! Thanks again for the pointer. Regards, Marco