From patchwork Fri May 1 14:55:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1281348 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=a/QSSoVB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49DFgN2b0Pz9sRY for ; Sat, 2 May 2020 00:56:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 40A4E822A7; Fri, 1 May 2020 16:55:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="a/QSSoVB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0869F82291; Fri, 1 May 2020 16:55:33 +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=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0727.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::727]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C0E17821FC for ; Fri, 1 May 2020 16:55:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f584meiq05/pyvYHoV+RD+ToGwh6n6hZaIIxqOBVASb+WufXthAmXvrDmiGCR5BYbZkYPKK7IFyFo0DMfe3yew7N1Sngcy60Z2vohvX5fjVsgNRLltt7ejNkkQTZiBNTtbUc66ACc0OpVJyzIujO/KqZGDa08guHp5fXYuOC4ZPMharYdbLrlArffk2Fr4Dx67sM8im88p/rGrHL8qYDrWcvyL15RnqIeAq5Uo8o5m1ZhQIUgmsFH7ey+DddHvaHtzcLAOOOORU5ybSTQrixpNgsMgeTV9zqq01ulbVH0EEVQElGsNl7a5/f63anZGUHU5xtbXZjQtDi1MlI4AFsUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IuvgCsjOetG/DFnkDnxoxjin+bCVu/z0FUBkqn9Zf3M=; b=XyR/Emer3uNWviGFcR/e3jAbeTwUixv6l5+RRkXb4Km8YfqtDXZUCx13pFrFgwaEu39Wtlt6/3+Q9dK95YY4u+CSwbM3z64TwE0Syht6LryHsAQUP3Q7/lH2aaxHy7QxoN2QngWwxSg1gI9eTQce2uAYYzfE49aPtwPKIE4ZYQf7btYVncw7cv2AfqmoxQYA+KjbE0MmbB0NMsN/3vNEt+GqpeAQ9uMNJAim3CXeO4HaYkAAB6ahS8AudRcV631ZQJssmF2kK32VBbkh5sqCBfE3knnXG3hVhcf23LBTGXHVWdDSIpWHWQKeGtWY5rYV3wY+a7iRNmb3FO/csL4A0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IuvgCsjOetG/DFnkDnxoxjin+bCVu/z0FUBkqn9Zf3M=; b=a/QSSoVBsKUqSAaNEf+N/grHBQ0IuOFgqe0GetJXZdwdimNXZlQwcvuACxrp3MR1YzYyxnIPxmXkxg80A4oE/S1ZtCqRcSxF0dn7vZn7d7gdFFdbS0uSnWUP6Cd7KVCHix/RrSjAmVkrAnhIJFxoVWqgyf4qfegBr0NTvqg8QoU= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1967.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:32::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Fri, 1 May 2020 14:55:26 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.020; Fri, 1 May 2020 14:55:26 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Mario Six , Bin Meng , Urja Rannikko , Rasmus Villemoes Subject: [PATCH 1/5] sysreset: mpc83xx: use scnprintf instead of snprintf Date: Fri, 1 May 2020 16:55:12 +0200 Message-Id: <20200501145516.18168-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Fri, 1 May 2020 14:55:26 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78f93e5a-7ce0-4d15-fb41-08d7eddfaef9 X-MS-TrafficTypeDiagnostic: VI1PR10MB1967: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:378; X-Forefront-PRVS: 0390DB4BDA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 99Dr/TOmi17Ytzqf87doE+VhZoc5AzvrgluQ+TsoCt8QyZ+JRwLZJcI7v7ATVIq5PLCPCq7FWS/Q4EHP55I8ENVqsb6H3bV0VzDH6GdQOcUPs5OA9qchb3hK3NXj+UZAeQjBn/mmReBhSuVIgOsnzFYyAfl9nOzHSLSBJVqL56J2IfrgBtLBIVHJHTLQQjCeRXCDu4QOjTJ0acvlvofyfuqTO2JpGAnUlWSsoVBjdAuF8hBRPVgr2SsjAXYUmABI8K1TWZxCa4ZgGaTAFZCs1dAm5DNExbw81VEJB6V/dy2mPbStYS7aR3OpsW5waj2k8ZR62MYXIVJXAO+RtMr9Y43WGnU2UDrxZfwbpyvnvywlU5yxxqN9iEJ+Ma7McNkG/I8c+Xq4U+hGUiJP4OaeZF7iYkcvMo4pG9N3rwYZSbbns8YO36tf5AL6ZEW0wT2X X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(39840400004)(136003)(346002)(366004)(52116002)(66946007)(8676002)(66556008)(66476007)(26005)(186003)(6486002)(6666004)(16526019)(316002)(6506007)(2906002)(54906003)(86362001)(107886003)(6916009)(8976002)(8936002)(4326008)(6512007)(478600001)(2616005)(44832011)(1076003)(36756003)(956004)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: oRCyarUyxRyVFiulDJ6XlWs7aC75s/L+NSw76rXRylrmcKkO8qumhHHP7sp6EZBigsGNElDEUGB2Tga+2iR1LmsbEz22+pDfp+u/ZVftIMeW25N+/SVux7X2g5DUOZGYoPY98sLrnyeJ2biRaOm2xjIKOV2wTTd5JvQ32REoKpvihn0XuNLSOq+2a3w4X7dGDnTaphdYWj8YPo0ROxMULNPmLBlFC15S/y6G4u6wznpl2HNChFzb/0SttfpOwXpTDdWxEpZomfTuC7khTZBUN+yZdZyZfAMCLiGb65bAIlEmhQdIeXZ4VVq1xV7a5gCelnGEe74JU7oOHPYVSJBoPswn9mfbuLKJusPQwIROqmKD8keqYnsdcxioaIxRfOWu+mYxirEW159Mgn/mq8bFsGHSIGcm5CVy6sKl7xQ1L6VTx3zJ9jDHiH6cbl5XFPfTgI9btqSyIrSM8/oGMyl2VEvuz5a0uMgp93s1zJvo4KLyZTua7+KsgwV+e8YwwZ+4sBjpRVrsuzqqxGvdcduLAep+oz5DhqGH6kV9lO5KlMfBrXln2ZZeFAW8r2UVn3AKyhMywNIBqB9xJCZ2tAn8AaFJJKWjRw4q3F+AYzBZjpmzPybpOPPPQRtdtFMpepkj/4gIE7rXFBWEkYfRbuIofJTuQv5tbepA1uonsAu78V11Rn+XHfExBdg8CxGlXO1tHuTgVZDASl4xcH15zmSYpGfTcLTOFLvrCB0ls5Ni1AQ1HRDTz6+btlekDHxKJafTFAWC9jF3mrFKk3MTdMRCdmX/94frWe3tlqbpGWAzAEE= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 78f93e5a-7ce0-4d15-fb41-08d7eddfaef9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2020 14:55:26.7151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 739U+F3HGY8xjMv+HkjnC+1kQyVLczegVZoyIdAqmorxb4OdlD3oc5cd5mLoDDcb5Dl0AiF26OiEDCCRln+/O4c2ObHdXPho3CISQT5mmZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1967 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean Neither snprintf or scnprintf ever return a negative value, so the error checking is pointless. The correct idiom for printing piecemeal to a buffer of a given size is to use scnprintf(), since that will ensure buf will never point past the actual given buffer, and the remaining size will never become negative (since scnprintf(), when given a non-zero size, has the property that the return value is strictly less than the given size). Signed-off-by: Rasmus Villemoes --- drivers/sysreset/sysreset_mpc83xx.c | 54 ++++++++++------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index 9092764e0b..7148464d8b 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -104,23 +104,23 @@ static int print_83xx_arb_event(bool force, char *buf, int size) return 0; if (CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_FULL)) { - res = snprintf(buf, size, - "Arbiter Event Status:\n" - " %s: 0x%08lX\n" - " %s: 0x%1x = %s\n" - " %s: 0x%02x = %s\n" - " %s: 0x%1x = %d bytes\n" - " %s: 0x%02x = %s\n", - "Event Address", gd->arch.arbiter_event_address, - "Event Type", etype, event[etype], - "Master ID", mstr_id, master[mstr_id], - "Transfer Size", tsize_val, tsize_bytes, - "Transfer Type", ttype, transfer[ttype]); + res = scnprintf(buf, size, + "Arbiter Event Status:\n" + " %s: 0x%08lX\n" + " %s: 0x%1x = %s\n" + " %s: 0x%02x = %s\n" + " %s: 0x%1x = %d bytes\n" + " %s: 0x%02x = %s\n", + "Event Address", gd->arch.arbiter_event_address, + "Event Type", etype, event[etype], + "Master ID", mstr_id, master[mstr_id], + "Transfer Size", tsize_val, tsize_bytes, + "Transfer Type", ttype, transfer[ttype]); } else if (CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) { - res = snprintf(buf, size, - "Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n", - gd->arch.arbiter_event_attributes, - gd->arch.arbiter_event_address); + res = scnprintf(buf, size, + "Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n", + gd->arch.arbiter_event_attributes, + gd->arch.arbiter_event_address); } return res; @@ -150,13 +150,7 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) int i; char *sep; - res = snprintf(buf, size, "Reset Status:"); - if (res < 0) { - debug("%s: Could not write reset status message (err = %d)\n", - dev->name, res); - return -EIO; - } - + res = scnprintf(buf, size, "Reset Status:"); buf += res; size -= res; @@ -164,13 +158,8 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) for (i = 0; i < ARRAY_SIZE(bits); i++) /* Print description of set bits */ if (rsr & bits[i].mask) { - res = snprintf(buf, size, "%s%s%s", sep, bits[i].desc, + res = scnprintf(buf, size, "%s%s%s", sep, bits[i].desc, (i == ARRAY_SIZE(bits) - 1) ? "\n" : ""); - if (res < 0) { - debug("%s: Could not write reset status message (err = %d)\n", - dev->name, res); - return -EIO; - } buf += res; size -= res; sep = ", "; @@ -187,15 +176,10 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) * event to be printed */ res = print_83xx_arb_event(rsr & RSR_BMRS, buf, size); - if (res < 0) { - debug("%s: Could not write arbiter event message (err = %d)\n", - dev->name, res); - return -EIO; - } buf += res; size -= res; } - snprintf(buf, size, "\n"); + scnprintf(buf, size, "\n"); return 0; } From patchwork Fri May 1 14:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1281349 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=QPMKt7jf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49DFgf3kqzz9sRY for ; Sat, 2 May 2020 00:56:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 31F638229D; Fri, 1 May 2020 16:55:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="QPMKt7jf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC0C382296; Fri, 1 May 2020 16:55:33 +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=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0727.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::727]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4EFAA8225E for ; Fri, 1 May 2020 16:55:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4bhYfruv1YFr0D3tDLfoliBBVORAyVrFr7XwnzVmOM3vIE7FZak59eWRlNpY2sXUxBKOC6LNjhotsJgBPiMV4f3AagQG/SrbPrqQ/j6j3FWgK7TWIbzNsoIrRZ/9+KgUEENlmZA2fkOy+x8EHyJmCpOJaCczR93grkYbqCi76D1UE3xkaDMCjDJcPkOpl85j9dkXzOrVn+LUVKMm1oZ/zjHVB6770jZAJQhJdawAPKj8zh/TISrcY1QdrNc15LfNlFsJZT4Vb/uf4kLtQDWRenfT2jgHRxMRarGqHLtKA6KSnCe2It+a61NU+U8SxQSW2BWHXvhYb1YivB17PrVvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qq2Iyc0vNisL2gqY3fx45cayTj6jISGr2rbvh9z5A4Y=; b=i07E7Pik7M5mTybZBJJXnFC76BOAvrWY2iwQTIO9QQbXPeSc1EcuuID0d2ke2hqWs4M2nM2aMxjXBwytRtWR9dACEiyd7F2TfIdDDUBKDp2RCTUUMt1XV1LXzoFzk6KqKRlEdCY2KjEgcZaDvxgd8jIreruv+mjURTmiBSGyss6XQ8Z3nMymkvPPsPkCLUBZW13qFB3nSW17utcea7wUMvDTuKLgD45Kw88vGW9VvY7URX1r+n9GB19Wy6bjZn+SNV/3LZjstbFPfWnuj8UtAmTsyCIw5WX5w/vG5meIoZzvWDn2PZhxF0zMCevVMRjBGSAVKdPz5OI3vhkPwtdH6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qq2Iyc0vNisL2gqY3fx45cayTj6jISGr2rbvh9z5A4Y=; b=QPMKt7jfd6DMsj2ewt3Xg4APri7Y6VqjKtRkXBD7ECCnLDR0tL7Qnkftjm1m1qMQwAivq216glz9389Sadn52c7/f0YEXJzqTdwI+Qyhpj9XgJOdgJztp6PfWYnYytz/alKtY8juWdfYcRPrIayS9sjwVcrpZKU27Afb8FsB2Is= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1967.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:32::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Fri, 1 May 2020 14:55:27 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.020; Fri, 1 May 2020 14:55:27 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Mario Six , Bin Meng , Urja Rannikko , Rasmus Villemoes Subject: [PATCH 2/5] sysreset: mpc83xx: shuffle newline logic in mpc83xx_sysreset_get_status Date: Fri, 1 May 2020 16:55:13 +0200 Message-Id: <20200501145516.18168-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Fri, 1 May 2020 14:55:26 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36d88cea-783b-4e5f-ad36-08d7eddfaf73 X-MS-TrafficTypeDiagnostic: VI1PR10MB1967: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-Forefront-PRVS: 0390DB4BDA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /6A9pWOH6u468cHsC3S6HxO1yq6ILePYsFFZV+ndgscn+9IBrebe0JjSfz9ONuCKsAunIe1RoxeT3h1P2jfpeX6aCduVfID/mFQDnF3dU92OZwHzUNERhqC8dbP61ZXIxqjXvK4vsjqjnNbelPVbD3QEq/hNl/EuZG0S9KQEWqRrlmYR/QreSL3GaBAMyKWAN3H4WSjPXHUIlvKb4BAOCsKF73VpWynH6adDSZdIJdJV8z8Gmtd//7n/QPaeP0ZFnn8oS2KuVbOUaZgw94SXMRub+EGJhpNN/vNnvSg3YZa1weJQtUrQ8qZhDKbPF2ClD91qlWygDL2iLxnKN0UpNSHt9Jx5Lfj5oDRGl/at51MF2aZvsV7XfvXA5RNXeb6fEEAKrgcE7ayHoGX+/aDeiSLtQhoDj2W7ZK74Hbgcq/3tY5KTScYOMj3nLAV2EMZC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(39840400004)(136003)(346002)(366004)(52116002)(66946007)(8676002)(66556008)(66476007)(26005)(186003)(6486002)(6666004)(16526019)(316002)(6506007)(2906002)(54906003)(86362001)(107886003)(6916009)(8976002)(8936002)(4326008)(6512007)(478600001)(2616005)(44832011)(1076003)(36756003)(956004)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wk7GzmTP6o0OsfyV0iLYyTpXUwIjWeBWgqrRNkr4K06cwGiihJwTFtYZ6EVgC7ZNe2Fw4geXI0GnQPmTqej2PvEF2/ywurQLREljX6UUPjTEKZ3S46YoR9HsvNYu4mP4u9gQr7DeRe/MLSbM6+gC4wT5C+X6Hpk+TrGs72miWvuIxkjch3GGn1nofaXlAiqKBr4OLas3UUE6LAY/FluB5Df11qO46Mrg6zNdVceJlTNVdC0C8bNXmhh+PJzHppAIldCPS1Hzu+g1t5E4bpLpsZxMzAUrnqB+5j9s0Bil4HiQwWGtx64lAKf4+8rQR/CqWuA+BmG+ongogKlt/i9Qf/d0Y5jJcl+0oF3cCyK60eKCIaFAfT633CyB/M0heSLYwaHvwkmRG9NLZTWBbWlqJaHUzyox53LwA88Gx2a7NSglvDrp1ndk1VlcLNJlYvEMDuke9gPxR8Z1QL5lgONZVCaGxsp2A9OUWghOtBMIPtOW1gDiLH8tlZeq2Rd+b2DA/cKEjorNw4Q2+twQbnpdFfHE7naOixhuTJe0w7UnzK/2mpKwbUTmuNsINIJJnhQ9t+4KBBxEfg5sVCafX/suvXU0Asxjep2f9MLZx78SD/cyHSbvWPyF/9oPGjMnqdCZK083hk/wKMOkofcMKFLzcomwSFSU5juu0jeMVDJsp7wAFr0wCrmKoikSEbc4jsMEAPaZd+koqX05u8MW9SVHKBdmVtvBi0fqb7QgNsoKDkHipWqYgJamGKbeK/tj4cQoTf/vLsWfXyIAHEEsNUNPx8/a+ueTWl6KMTMukp+ioj8= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 36d88cea-783b-4e5f-ad36-08d7eddfaf73 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2020 14:55:27.5067 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i896Y+gz2SmDnS8f24OeSfSlZ1QsatXdofQZMc17MOwl/+UKRf/hAHFIYhjohqHb0IQCvxNQO1FIBABKSIz7JaMzw4xWNGbhDrlQPU0opUY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1967 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean mpc83xx_sysreset_get_status() adds a newline to the buffer at the end of the function. There's no point adding a newline in case the reset status word happens to contain the RSR_HRS bit. On the other hand, if one of the CONFIG_DISPLAY_AER_* options is enabled, and the RSR_HSR bit wasn't set, we'd miss a newline before the print_83xx_arb_event() output. That latter always includes a newline in its output, so just pull up the scnprintf("\n") a bit. Signed-off-by: Rasmus Villemoes --- drivers/sysreset/sysreset_mpc83xx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index 7148464d8b..3447b8e75c 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -158,13 +158,16 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) for (i = 0; i < ARRAY_SIZE(bits); i++) /* Print description of set bits */ if (rsr & bits[i].mask) { - res = scnprintf(buf, size, "%s%s%s", sep, bits[i].desc, - (i == ARRAY_SIZE(bits) - 1) ? "\n" : ""); + res = scnprintf(buf, size, "%s%s", sep, bits[i].desc); buf += res; size -= res; sep = ", "; } + res = scnprintf(buf, size, "\n"); + buf += res; + size -= res; + /* * TODO(mario.six@gdsys.cc): Move this into a dedicated * arbiter driver @@ -179,7 +182,6 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) buf += res; size -= res; } - scnprintf(buf, size, "\n"); return 0; } From patchwork Fri May 1 14:55:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1281350 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=m3Lozatl; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49DFgw5PJpz9sRY for ; Sat, 2 May 2020 00:56:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39115822AC; Fri, 1 May 2020 16:55:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="m3Lozatl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D93A8229C; Fri, 1 May 2020 16:55:35 +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=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0730.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::730]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 34965821B6 for ; Fri, 1 May 2020 16:55:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwBfeNhm15WiCbGlBdkJOl5+w+Am92eGyRdwvg7IEjbA+HpeftHNSXzRPc0X8PWvXabIFvn1u6nGopnWaakJkBuXKjkQYXhRlm8knb5ggeLynzAUD5QCdzB0YVt5pK3tNd0VKy7AVBtQ9QuxtDORe2l+CNlboeAURswHm9tC4v74ZLKVwGfNcUEZUwSY9J6iPWOti5JmwGyCrwYcKbmPnkz+IC2tdNZCpmv10f6wLDqcx+FtzBNs0pZijlDLOXIzphCIFo2CTw346GLSRkUu87S/UL8076kzTCbazloLZi7uXnLHyWOkqQ+csEvlgh2xqQWUX27OgMAYZbEdVb+WHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KuZEuPNRYxo/T3ajdf+2EfW1984t8MXIswr5A1ObHlk=; b=jqvPt0WFC7/pkho1kBcFdh0XOHC0wyWYcq+PlHYo4GSx+iCEkRsotaCIBiGwKlUyQzYCMje9LkL2pfOxJcvKfWEb9XjakQ+/+Y71MyH7xrKKR/O6JrYoHeEByTgqYmyGiPpd0UzmAN4ik7xkb13M3ebm6Of9hz45DVAaf9xO3kdhCzvVzJAmcgJzhrW6/wqExEgxTvNdwyzMzbAGfcQx6TQ88nQ0DqUY3zgNoqz9EhaKWhp2orbQtyA9eiaOpsWTMqF7Z28xRArZ7tZ3ET16q1TWC3S/EOAOPn/WBIycWGb5CDDuGEmo/vRYG9xPeXqzAFOaFQIpPFZ27zV3DUTQeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KuZEuPNRYxo/T3ajdf+2EfW1984t8MXIswr5A1ObHlk=; b=m3LozatlKGCSkFE9fFdAWrOFQantoPAsyW76EghUS/l2k1uVPSzPPFc6xS38pTDRDu951Waq6vf8maeWeqtFXP24uzB9PXwEgUjJ3MAiHqzRRtFIRsSKRMQw6pjm/Atr0G+/C9CUkqaideW87kgcqk+Der65NouM+bA28oZlzyM= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1967.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:32::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Fri, 1 May 2020 14:55:28 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.020; Fri, 1 May 2020 14:55:28 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Mario Six , Bin Meng , Urja Rannikko , Rasmus Villemoes Subject: [PATCH 3/5] sysreset: mpc83xx: fix CONFIG_IS_ENABLED logic Date: Fri, 1 May 2020 16:55:14 +0200 Message-Id: <20200501145516.18168-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Fri, 1 May 2020 14:55:28 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9dfee69-50a8-4315-68c5-08d7eddfb01d X-MS-TrafficTypeDiagnostic: VI1PR10MB1967: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0390DB4BDA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lA3lEDqm0O3qbhLjGaoUTMqbGU9DxCNoGMi+4brfCEkzQj8tIBlITbBEDZELjXbQ2lXyoCA8sbwc6AFJXdjiG5Dh8g5nYFqlN9ZQyBt7wmEh6DQpMh3njqUlm9pqu+u9ohzRyqCSbnBduYTSH1RRKCVwECYblKBoUdmnYvODhbuFa5MI1pmuzUwQKMZTVrj2OSVZMTWcKUQSQJcwWqhE8cplpWQ+K/CFthW0p8wXSk1c3pnZKMK5FUkkf7PSDe47UpzHyC27NDDw7Bk8Q7PDWJNp82PUG04S/9i4N5ZOtSgnB5ThUOq/R0EOkC0pXKo1qwmAAbfdZ9hDdT3kCgm77614xN75lcIwyZ4PLwZxhIObl7gI7h5qiPFLJBwt2zDCuZPWp2AOrvPsN4pb3QJqHZdh7+RYJA18vdMt1MnUtOAleD9A2PCtH9aqMVPMBMP1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(39840400004)(136003)(346002)(366004)(52116002)(66946007)(8676002)(66556008)(66476007)(26005)(186003)(6486002)(6666004)(16526019)(316002)(6506007)(2906002)(54906003)(86362001)(107886003)(6916009)(8976002)(8936002)(4326008)(6512007)(478600001)(2616005)(44832011)(1076003)(36756003)(956004)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: uXiqdA6q0DGqTyFAbuwHTYIuWLkDMGEQPlhg3I8S9GHCs5wWmBwUdxI+GIO159JDDF6GmQZqH8Ky8QuACZ+cDPWj+3ha9y+RkhpAxiQio/7DUoqfhYPBqGpezOta9U3PCD18AKc9xYfnrymJ5Bjks8fJVYaA3UAl9cpTFsrkZgEwRoeot7Pk4OlEJzpJBn5p8oCUyFvD5RTQHmqWpkvaq1QbM+IsQ8Ij1Dws3ihHdImWc7j7L6dw2nc+6f0WrX6bV73C2uWsUrckpQGhC7MMeHaNo6CXIKJbvYj6oruXk04cjVr1ipFgPHhxVIww2y+vNZpE6XKS4c/VdG+DihpsMTNnEc5HlBuRrUna2egmXzZxSU5VuHyGcyEnsU/97Zg06vmm6xPmG4Qo/gKmjBKrQvUf4TX07BQUCGvshmfyuLX45Cb4yPKboflZxkwNDBthEvQO/ocuOezCmw6Kuihp5cT5dv2pFnc/IHDmjSoRBRRcpCuyDLgFYnumqYvbuteI3f4xaFVCVxi1QddCpXI5zEsqEekQxewZL/thHgAAoY5kmPUXpLICUsBntRueq9USOHMJYMBeeCKaF+SMURp85687gXAOOlbsukyekBlEmufEWIlrTKeDk+VuQhGOSJD6HQiBsZFUEnHo8g+e4F00JmYz2Uk3AaxJ+b9r4rPOi0ZKQ+6Q4CVq5zp5L7IPTOYBFagUzxI6aiB8XlkEq1tp7O53A+GOJl72OOPFC89jindVs21DkqvDov1rSHSs+BsoxPnmCDlB47bktqJQLe23f2ht9KCoeVvz7eyxd+yn5sQ= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: e9dfee69-50a8-4315-68c5-08d7eddfb01d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2020 14:55:28.7530 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CvJOSm7q1PU1audb9ePlS0dPRZ51amSkM/GVT/V6cnTvUJG6Dlz0lii/MpsN6mIyTDCCV5VG2hx1qYvbIcqddo0yM0oqKP5f2nDEUv0OWgI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1967 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean Unlike IS_ENABLED, one should not include the CONFIG_ part in the argument to CONFIG_IS_ENABLED - currently, the first of these tests for whether CONFIG_CONFIG_AER_FULL or CONFIG_SPL_CONFIG_AER_FULL are defined (depending on SPL or not), similarly for the other one. Signed-off-by: Rasmus Villemoes --- drivers/sysreset/sysreset_mpc83xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index 3447b8e75c..631ae6a5dc 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -103,7 +103,7 @@ static int print_83xx_arb_event(bool force, char *buf, int size) if (!force && !gd->arch.arbiter_event_address) return 0; - if (CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_FULL)) { + if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL)) { res = scnprintf(buf, size, "Arbiter Event Status:\n" " %s: 0x%08lX\n" @@ -116,7 +116,7 @@ static int print_83xx_arb_event(bool force, char *buf, int size) "Master ID", mstr_id, master[mstr_id], "Transfer Size", tsize_val, tsize_bytes, "Transfer Type", ttype, transfer[ttype]); - } else if (CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) { + } else if (CONFIG_IS_ENABLED(DISPLAY_AER_BRIEF)) { res = scnprintf(buf, size, "Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n", gd->arch.arbiter_event_attributes, @@ -172,8 +172,8 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) * TODO(mario.six@gdsys.cc): Move this into a dedicated * arbiter driver */ - if (CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_FULL) || - CONFIG_IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) { + if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL) || + CONFIG_IS_ENABLED(DISPLAY_AER_BRIEF)) { /* * If there was a bus monitor reset event, we force the arbiter * event to be printed From patchwork Fri May 1 14:55:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1281351 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=fcnaKmNF; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49DFh94FgFz9sRY for ; Sat, 2 May 2020 00:56:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8583C822B3; Fri, 1 May 2020 16:55:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="fcnaKmNF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11BAD82291; Fri, 1 May 2020 16:55:36 +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=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0730.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::730]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E8808228E for ; Fri, 1 May 2020 16:55:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hsWAqul/D9GU8amNSsDtDZNyXIHWyJHaZo2xjPQuRd0/H7lZVJaPUC2B+I5KLrRwhYeKWS7Di+eITsgccnEQAknQH9i4zfXx1fwI5gwDE9Vd5MsUDLIgVhlKXUYwrydUkmF7xNpbRzlBE9vE11AS3Z1FflMJ+t0ahmUgOyO/EmGm1afq8LdlEYycRJQU61rF4G6FhvJWi5qQMRQZH/cC1ah9LesliilKfZ8WNxDoVb3XAreicI+8jt84GE8YMtUqj6sm/HFqd6mwBpNUvif/GJaDrEpndYSfVm7lnurXzwlBYWkD6x6tA8k6unYndBR+o7F6XutRIl7ReSoGbV4oOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TwKfSoDSNyqeH3kgTyWiWyZkgvH9q6oiSvIEc1OZ9d0=; b=jCKZVSCLW/3pHp9Ws0bK1VhfbHlp4AQ0hmePdgwaoslIopc8btqDgnr0p8SmjFOIRLXVbh8h4mipTWTxXymYUg5P3EJc3RPFfrBJNFkKx3NDcisCGy5swW3ml8N6GpVZJEYktVKwo6uashaZUUFqNAxdM/7Dz0rUiBQxOs4DgzlPXYHuzEoNEYnv5Xgjb51fiEzMp0qR0mm7lhZVab1sc+yUC3fTxjoZTIW82nVqxXxVHH7OQjbNJmUljgCLTQj6UTIQBvX+iXIztNw8YhjlH6BjBEZtyK/NQxNBKU6KZYPYc6g7mzVzyly4WvSK7eQJGNfXCjDcvFlzuoawQWe+Nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TwKfSoDSNyqeH3kgTyWiWyZkgvH9q6oiSvIEc1OZ9d0=; b=fcnaKmNFt3jVUqR922WBSL4t5KVAVyY6kDnajbcMOW0LgVuxG+/oY0mYjbImZa2KmdWnK2zhbQeC82nnoTcS9yvRWubLe4GH3nwo4pVjUJ0zdlKqPoEwnxQ3+4jYOFhFLXIn0sjcpRRdBAaH5+uB7cvSWFKJrkVg0/pu6cuDFd4= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1967.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:32::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Fri, 1 May 2020 14:55:30 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.020; Fri, 1 May 2020 14:55:30 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Mario Six , Bin Meng , Urja Rannikko , Rasmus Villemoes Subject: [PATCH 4/5] sysreset: mpc83xx: add output in case of cold boot Date: Fri, 1 May 2020 16:55:15 +0200 Message-Id: <20200501145516.18168-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Fri, 1 May 2020 14:55:29 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98375361-7e6f-4cab-c267-08d7eddfb0e9 X-MS-TrafficTypeDiagnostic: VI1PR10MB1967: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:459; X-Forefront-PRVS: 0390DB4BDA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F/s6HIe/Y/A6v0nqxL+Drf4DnyzbZeahBJfy7XtOVpCYo8KZgFcawbf0fmxaIn3/IAmlLQN2GTlEbqg57dmon2DyZBjyAfF14J1bEvAcwOLYCJHJ6vfcCq9lprYad9cpTDl6kqUm3KEylNrFQCZNSmqDNPQEJkFX7jkU8RP6IRviclLpdO36FNixMIwKFfowqGV1ujnVJQSWe7N8ppPNLAGd8fPKFsdyBpqwLf4Tp7xZq6+bpOHVRC7WT0G/MAsqH874+F8RJli4wrwwZg1J/UInsiJsTgBOIEuNI2Q1etSxvUHdFr/2kX0BgXiYZ34XVviHzdpBxvOkAaGvtd/8fMb+2X1vLIOkjYH7zFcfQO//gsqKqLVHAlScNsAt2WcGSF6Bfywzq02sQauZdmFqnN9MjWHtid5SwEp5hVEpQIt18FKpMLniHAoYRnlwAYyP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(39840400004)(136003)(346002)(366004)(52116002)(66946007)(8676002)(66556008)(66476007)(26005)(186003)(6486002)(6666004)(16526019)(316002)(6506007)(2906002)(54906003)(86362001)(107886003)(6916009)(8976002)(8936002)(4326008)(6512007)(478600001)(2616005)(44832011)(1076003)(36756003)(956004)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: lEgim9YgPohe+tfCc6evzPYke8Omgz3LCJAWgNdMdQg0rvHBVQ0w72e+baWiHpG6j5mQenZTaHDG4Wr5XdKLQ+TLgMJhKWDRppBeBDiyLO9XthpJ6qHxXA7K3KTYSWnCwiFX38ma7mYf/8Cg11A3DLA0YHzzqmSEG+UTTK+4M7vhs4mmxf1VfbTcM2tU3mEGx2QLLqJTdPxiZEfGY1pNbw1iTyFe4uEJYuRxDrj/wv1FZbhz6utbDVY3FpkpeC53YMHZqKizZRpwz5ftnrbt6ec2mpFhaGuqIZR8JfrTyfGjSlaKPszGV+rVaSoh/YpyIXBm2aHGYA0bVUcoqJfhm9CNvlAwRyWJatEgKjRngB+wtnb+9XMEMYQKoqf10c78EXcAeHB1I+x2HnxW1QsYAJVnFjK2ewDw5MeGQoQW2OBpqxLE9O8GK+RE70EGzY56w1Ixw2sCQ1+6wmEOHe/wkvBaPpFB9y+cSRUIyK3xXhVb+ktdxtyoaa0Y7scMzr0yJWjowdD/K30chUHnY52raqskRH97H8tb2Fn+PGvOUiXl549biJxWGu+SsTJjLvj8GkD8LAqNv4ltMuRWmd6kxfvkJuK/9YGXhuua0aMYRZFTtE2OfBsdO4YA2AU7+2AjPwywKjJDwAgjvmF7UxSsgykw7Wuo9/iNtxFPIKyvPFACl8ndrsYaeQmy8Pnk5ZWlS7idRy9FpC+fQmY5+8f3OaWb2mFJHY7a4QTS6k6ieenhVJpE0KnnkQVcNmIA99F1tSn65IkFJipnjIg60if198p1O+AL4HjPLM2vjhmT6u0= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 98375361-7e6f-4cab-c267-08d7eddfb0e9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2020 14:55:29.9473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3OoC/QrJurMQEsEL0CwT5ett+NiEbOQQa4ZF7HNaXDLlKTSFY8hEGAqBLIq0S2BJXQp2mBr+RGSBK/CZq2mvRXoxVBh82MWHINIltCv18bk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1967 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean For a powercycle/cold boot, none of the RSR_* bits in the reset status register are set, so one gets an empty Reset Status: line. Print an indication that this was likely a cold boot. Signed-off-by: Rasmus Villemoes --- drivers/sysreset/sysreset_mpc83xx.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index 631ae6a5dc..6457d73418 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -149,20 +149,28 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) ulong rsr = gd->arch.reset_status; int i; char *sep; + ulong known_bits = RSR_SWSR | RSR_SWHR | RSR_JSRS | RSR_CSHR | + RSR_SWRS | RSR_BMRS | RSR_SRS | RSR_HRS; res = scnprintf(buf, size, "Reset Status:"); buf += res; size -= res; - sep = " "; - for (i = 0; i < ARRAY_SIZE(bits); i++) - /* Print description of set bits */ - if (rsr & bits[i].mask) { - res = scnprintf(buf, size, "%s%s", sep, bits[i].desc); - buf += res; - size -= res; - sep = ", "; - } + if (rsr & known_bits) { + sep = " "; + for (i = 0; i < ARRAY_SIZE(bits); i++) + /* Print description of set bits */ + if (rsr & bits[i].mask) { + res = scnprintf(buf, size, "%s%s", sep, bits[i].desc); + buf += res; + size -= res; + sep = ", "; + } + } else { + res = scnprintf(buf, size, " Unknown/Cold boot"); + buf += res; + size -= res; + } res = scnprintf(buf, size, "\n"); buf += res; From patchwork Fri May 1 14:55:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1281352 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=PGJIQjVO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49DFhR4cY4z9sRY for ; Sat, 2 May 2020 00:56:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CA2B822B7; Fri, 1 May 2020 16:55:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="PGJIQjVO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5F2282291; Fri, 1 May 2020 16:55:37 +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=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0730.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::730]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D767D8228F for ; Fri, 1 May 2020 16:55:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a+AS44DjYuaMremxaMhvVX8NdLSLYDeBlBg4zmoXAmoxzSjl9AAuqF+S+rexICCDMD+FHP9gLOmg8FkhMFtVToBAb6Yp9dq8Hzwg9uPc3fXvlbA4iDKGzfKL6TseP1dxVlf7sTX6x2QLoOwdadrbZK68Gq7IkK6Ib9OE8w/MxPRByUK9hAy0YAd6jXZE/b+YFptXIx8cETO7GLr+TaKYCdL59ujTopN50iiuHcl+CL3CcXMWPZ89a132Xk7yLWSlyWH/BT782TSKMaeQvVsj19R30l50glCfI1GuH5BnWn6Mu7hLRSWTvXw2CX3OPEHJU/wDKKnQK45BMnfjOOR9+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nFH0G9BnIROrXKovxYkcpOBFDInI9G1kAuxJl2ooT7Q=; b=HAdZDMH6CiU17YvPJBGAZkn95sy6c61jcTqZEbEh1FRIVYjua4gX2S19cl5x2AfNCzAP51WoqP35Z6TthG1gteLx/KSKhOLjsY0rc8SoP//rdYyH4vXN/J7hs03xzdrfNttZUlK7G7VOcaxpM4PAsZ8U7SEO2zwqshcnyNrwwNvekp3jfaaKmUl35lRSa6Jktx8+ikz0ZeOT1+wurnVPPuqHLLl1gFE1d302VzkheupWFo1LPERrr9V0YF9AGJAcadbfE9x9H/rKQKEbkZ6Hpq3n3YQ1FerzcSYRDJJTzAKlhpUbTn1AcdtWZFkFz2MhVBWi2mrU/iAy2xP/UMcSjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nFH0G9BnIROrXKovxYkcpOBFDInI9G1kAuxJl2ooT7Q=; b=PGJIQjVO3v1pbgfZGQRhwkI9axVkjQ2YQs4lYryz9qgNXV/Zp17FChWPCwqgEJ90wJk65zKs2Ade71uxGq7KvjqYmgUKm82X4R2mpVrusVISwPH1OK0bqTRze/yId3FFobZgyQjyAczbgQTSkk8/5PmmzxpFmdGXjU1FjxG8/dQ= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1967.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:32::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Fri, 1 May 2020 14:55:31 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.020; Fri, 1 May 2020 14:55:31 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Mario Six , Bin Meng , Urja Rannikko , Rasmus Villemoes Subject: [PATCH 5/5] sysreset: move print_resetinfo() to sysreset-uclass.c Date: Fri, 1 May 2020 16:55:16 +0200 Message-Id: <20200501145516.18168-6-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR0502CA0065.eurprd05.prod.outlook.com (2603:10a6:20b:56::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Fri, 1 May 2020 14:55:30 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2788d476-6a79-40b8-f64e-08d7eddfb1a3 X-MS-TrafficTypeDiagnostic: VI1PR10MB1967: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:67; X-Forefront-PRVS: 0390DB4BDA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cZLG/kU5BdTmyl0Bq0wBd0ELbNB/sDXkMC+/FyqSGDqMMgiJfn+m6vegBpMSWXPqomDSy8nPWUY/SJNDVzg3OWsbTjGbx0bJ11EJ8YlVzFUafHIo58g3JAadENnM3nCgYscmAUlUYw8IljJuTq/Scgs4nJXqV17KPcliTQxwh4kC1OkMr0sCw6Y0KUhhlSrcgoEL2ES7POp/YP03FnfEA6sRiMV7d1jMjJJN7yb5taI3pp3mzgjucnyABPhcgYWQvGY7Oa34ZVDFKe2fONfQSQfqPewZyuLdBako/D6qjfkd+DggUt9QaZ1G02/EVdkC6By3CuTwT7+TUul8qtqAr8Cw8cM5STWUnR+ZIWBlOgAuiA9T2NLcNnOantcUw4y/yzoN+M7xCAljWi3JvBAq3x0rqTC/3llMhPhFyPtcEIOLOJBUhS8J85bS/7Ndj+4t X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(39840400004)(136003)(346002)(366004)(52116002)(66946007)(8676002)(66556008)(66476007)(26005)(186003)(6486002)(6666004)(16526019)(316002)(6506007)(2906002)(54906003)(86362001)(107886003)(6916009)(8976002)(8936002)(4326008)(6512007)(478600001)(2616005)(44832011)(1076003)(36756003)(956004)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: r/4Q/gENreuc9ZXVCIEm8wCF8cKJgFywAm6q5ux05QKBHk5p3oRLoan8zWKamesc3rYXysq9qs12RhRzdkPfsx2eTf7WZz4NqUu4WPKUIvSJWI4F0btTw/e36bqNI+V0qjnXQLuShc1Uk0qHTpOqLxejzPIaMOFE7BPBD+gS9JhZUZHg/vBnLZUPQdub6ZG2+LvdXk/82H92k/Xgmh68B/i2CrNnkMOmgvjXXn9Vb7NlkL9tE1jLSM9DwIecCBe2hgzIjpslNj5RdLIS3jGdGiI3Rq62RwFqytakjmVH6Z4mvoU5scTPC//LMUVsThZ79v4HiV5j3mE2vEtyNKucleis0bPbDqrhT7KHSEk+jaWg7asklFeSF1bcDVQtDbVoYBXI0MY0BvDyvMsU1OtLl9zxWIqzS657OIqfY3yGzXgKM1jFk0iPj+cAwQArH205o9umtqd8nIfqcXTg0hxYw7CMP9Rxl6cb0epn+pYi1Zz0yh3yHpYDA8iAGzEn4pCEkz4SOEcBTRlH+z67NHS2kSRb7TuVWJ9zKwTiNX5PirAdEGz20mOy/wY7fjhC6b1ia8tuSOy7SzUtI3ZcTN4Ma8sH7O9gVmE5xUgHPnh6RI07mfCOYX3sKamFVk1HK6322+GvOOl4nDBn2nFnR5mZFU/HovOBrvTD2S0anhn8m8KLteaRi0Q4N45DHHIT3izbyOGG2XT5deWWiP77ErcjfaSmKIV0+lRGQbAfjO0KBhTdCUjz9xFfTyUFrAJwPO+yg4ojVR686XM3EejR92Js6oz+PS5GDekKj/vjTx9X+94= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 2788d476-6a79-40b8-f64e-08d7eddfb1a3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2020 14:55:31.1686 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t6NLdju6jRfOb6WWtxdcqDPa1cKGyt2BknCq6KqZAPlQWc/mG68heEVnOhB5hWIMc/NpuqJdjvk61T4bv+PkEkcxBnGwhZ4mg0y84YQ/HvU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1967 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean Moving this out of board_f.c allows board-specific SPL code to call this rather than duplicating its implementation. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- common/board_f.c | 24 ------------------------ drivers/sysreset/sysreset-uclass.c | 22 ++++++++++++++++++++++ include/sysreset.h | 5 +++++ 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 82a164752a..252ad1c520 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -152,30 +152,6 @@ static int display_text_info(void) return 0; } -#ifdef CONFIG_SYSRESET -static int print_resetinfo(void) -{ - struct udevice *dev; - char status[256]; - 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; - } - - if (!sysreset_get_status(dev, status, sizeof(status))) - printf("%s", status); - - return 0; -} -#endif - #if defined(CONFIG_DISPLAY_CPUINFO) && CONFIG_IS_ENABLED(CPU) static int print_cpuinfo(void) { diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 51fdb1055e..739e4526ff 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -18,6 +18,28 @@ #include #include +int print_resetinfo(void) +{ + struct udevice *dev; + char status[256]; + 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; + } + + if (!sysreset_get_status(dev, status, sizeof(status))) + printf("%s", status); + + return 0; +} + int sysreset_request(struct udevice *dev, enum sysreset_t type) { struct sysreset_ops *ops = sysreset_get_ops(dev); diff --git a/include/sysreset.h b/include/sysreset.h index 61295e3fcb..5f402b9d04 100644 --- a/include/sysreset.h +++ b/include/sysreset.h @@ -116,4 +116,9 @@ void sysreset_walk_halt(enum sysreset_t type); */ void reset_cpu(ulong addr); +/** + * print_resetinfo() - print reset information to console + */ +int print_resetinfo(void); + #endif