Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52A6EC433FE for ; Mon, 10 Oct 2022 18:30:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19D4584EEB; Mon, 10 Oct 2022 20:30:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de 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=suse.de header.i=@suse.de header.b="IyGTllSr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="M+IeKIgz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61D4F84EEB; Mon, 10 Oct 2022 20:30:11 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 332B884EEB for ; Mon, 10 Oct 2022 20:30:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3BB0E1F930; Mon, 10 Oct 2022 18:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665426605; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HbMytwylp7J0zMttuJv2V0Mrj6AVMYui59d6FPPvIbg=; b=IyGTllSrwZ4HXyPtGFy5TwN9+aEI1niu6FzjaGaZgW7hEEc32wdsxNei8evHr4D4w5qZfP YOSGu99JfJkpeer3FWruDfeYGXSqm4Ry9Qud+p9SizkA1Pm3vZBfVawLGi3yRRMmxzFtFQ C4Tn80PNsKD3Y4h7lFLEDpaCE2vNr28= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665426605; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HbMytwylp7J0zMttuJv2V0Mrj6AVMYui59d6FPPvIbg=; b=M+IeKIgzpryFwURzmGZikqPMV5iXHnQyfSEAnhr6SlTWk21hC1NK8KV/xBaem0rcQ4R3me nlVnN1uoZjy52gBQ== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id EABFA2C142; Mon, 10 Oct 2022 18:30:04 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Marek Vasut , Mario Six , Ovidiu Panait , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Simon Glass , Stefan Roese Subject: [PATCH v2 2/2] common: board_f: Print information for all sysresets Date: Mon, 10 Oct 2022 20:29:40 +0200 Message-Id: <20221010182940.20641-2-msuchanek@suse.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221010182940.20641-1-msuchanek@suse.de> References: <20221010182940.20641-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Boards can have multiple sysresets, iterate all when printing sysreset info. Fixes: 23471aed5c ("board_f: Add reset status printing") Signed-off-by: Michal Suchanek --- v2: - do not use errno_str - rename flag variable --- common/board_f.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 5f1711181c..4355d1c82d 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -146,20 +146,27 @@ static int print_resetinfo(void) { struct udevice *dev; char status[256]; + bool status_printed = false; int ret; - ret = uclass_first_device_err(UCLASS_SYSRESET, &dev); - if (ret) { - debug("%s: No sysreset device found (error: %d)\n", - __func__, ret); - /* Not all boards have sysreset drivers available during early - * boot, so don't fail if one can't be found. - */ - return 0; - } + /* Not all boards have sysreset drivers available during early + * boot, so don't fail if one can't be found. + */ + for (ret = uclass_first_device_check(UCLASS_SYSRESET, &dev); dev; + ret = uclass_next_device_check(&dev)) { + if (ret) { + debug("%s: %s sysreset device (error: %d)\n", + __func__, dev->name, ret); + continue; + } - if (!sysreset_get_status(dev, status, sizeof(status))) - printf("%s", status); + if (!sysreset_get_status(dev, status, sizeof(status))) { + printf("%s%s", status_printed ? " " : "", status); + status_printed = true; + } + } + if (status_printed) + printf("\n"); return 0; } -- 2.37.3