From patchwork Thu May 4 22:58:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1777187 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TfVy+uq6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QC8cK6Kl1z1ydV for ; Fri, 5 May 2023 09:08:01 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A479861B3; Fri, 5 May 2023 00:59:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TfVy+uq6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C8D2860F1; Fri, 5 May 2023 00:59:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 756E285FFB for ; Fri, 5 May 2023 00:59:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-76355514e03so76319539f.0 for ; Thu, 04 May 2023 15:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683241156; x=1685833156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fSI6NllP2NZfAfgcsoHF7zYdZTJs2FN6KpMauQ7ZBhU=; b=TfVy+uq6mNXS5k/T43CDg1TLyP4cm30TLE97zpwRJ8sd9wUIQ4FGwvpXsiR0V/EtQL Auw6G9/Tv/f9Vdrti3/qEjHs8nQmUPnVvYT5vZQVDMtN/sH4wszENoB7DyHR5RM62OU5 /4IGYP2Ob1TuC6qEOyHKV+bZ+MHDmJhZ7Cv6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683241156; x=1685833156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fSI6NllP2NZfAfgcsoHF7zYdZTJs2FN6KpMauQ7ZBhU=; b=FfOTGh1cg+CLkDEZ9sadBehpskLMrmCZc8UPjiq4RhX3GLDrgM4nwV8gTLDExv/Zkh 1v7Loi9hVHT5fgoLRoHMRRBGy9NGFbh5dbAR4Wo9ESsc5yEpxbFErzuHbF6Kyhz9fk2m HvkF3WsBwDMkpvT6JjtvSqhjA3LfobJMVV5OBiKTaj8wrGfT8FcXpJ7Rvq5ymi1Ot5p4 5IhmnI8XfB3MF5Ynad7PvWZUks9lNAcSUTjdwXq2vuGtQq5a4n0qWwvoKDOxVWZbta0Q 12IqTwW4vlqLmmahN8dl1RyCdh7iGTCppDq+ywvjr8WTG3cbpyvFSAXepQE1AVrVCKdr H4RA== X-Gm-Message-State: AC+VfDy97JDNcGnXsBU5xT20KyZPJDSZ6t6/n2xrP/oCOuh9vv7/xS3L V0SR4z/YO5cuRtWkQXqxbYDyxx14PAVGwkRVX5c= X-Google-Smtp-Source: ACHHUZ53myk13A+OSRjVrWVnULZBI1PlhORaM5quteVqcF/k/b7bcIkPjeC3bbVLL7WzWkNJjH9Myw== X-Received: by 2002:a05:6602:218a:b0:760:ebf0:bdfa with SMTP id b10-20020a056602218a00b00760ebf0bdfamr322558iob.2.1683241155955; Thu, 04 May 2023 15:59:15 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:b5a:9fa0:3da:54ec]) by smtp.gmail.com with ESMTPSA id e11-20020a5ede0b000000b007608af6dfb4sm39506iok.31.2023.05.04.15.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 15:59:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Nikhil M Jain , Bin Meng , Simon Glass Subject: [PATCH v3 40/43] log: Support outputing function names in SPL Date: Thu, 4 May 2023 16:58:26 -0600 Message-ID: <20230504225829.2537050-9-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230504225829.2537050-1-sjg@chromium.org> References: <20230504225829.2537050-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The output is garbled when tiny printf() is used. Correct this by adding a special case. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add new patch to support outputing function names in SPL common/log_console.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/log_console.c b/common/log_console.c index f1dcc04b97c..bb091ce21a4 100644 --- a/common/log_console.c +++ b/common/log_console.c @@ -37,8 +37,14 @@ static int log_console_emit(struct log_device *ldev, struct log_rec *rec) printf("%s:", rec->file); if (fmt & BIT(LOGF_LINE)) printf("%d-", rec->line); - if (fmt & BIT(LOGF_FUNC)) - printf("%*s()", CONFIG_LOGF_FUNC_PAD, rec->func); + if (fmt & BIT(LOGF_FUNC)) { + if (CONFIG_IS_ENABLED(USE_TINY_PRINTF)) { + printf("%s()", rec->func); + } else { + printf("%*s()", CONFIG_LOGF_FUNC_PAD, + rec->func); + } + } } if (fmt & BIT(LOGF_MSG)) printf("%s%s", add_space ? " " : "", rec->msg);