From patchwork Wed Mar 2 10:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1599645 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=B6V+jrV5; dkim-atps=neutral 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=) 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) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7rZr2fbtz9sGD for ; Wed, 2 Mar 2022 21:53:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 61A1E83C96; Wed, 2 Mar 2022 11:53:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="B6V+jrV5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F039583C93; Wed, 2 Mar 2022 11:53:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.5 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=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (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 6EB6A83C88 for ; Wed, 2 Mar 2022 11:52:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EAC161736; Wed, 2 Mar 2022 10:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5380AC004E1; Wed, 2 Mar 2022 10:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646218366; bh=OZnwUtzW3B+lyqEPuuW/0U8LS5tJ7Y6GVsysPrsuxg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6V+jrV5DKHND2UvAgBi4KlZD8By5n5eYh0aLW2yWUJe1PXMxYmVE+2Jri3vGooVW vIF9VOh/tGcpJ/7beW4XEv4zOWShm1Vb29cq5BVJEG7/Ju+azmvv/Lhs/vW33tTZLR D/IrFbbtMYb4pfQaGh11KsHhCbPSnjF3FcsryuI9sB6J5BBM0fJEC+3exv4uNOKxYs Ig4pMzpwxIxX8P9kUq3Z0CzQ6XKh3M/vkVM436i2kZ24WWB8UWd7yXDeaHl2wlukF6 JuihSbAULT1stT+5hJrDOII/CeXScb9WOAmG7okG3PJO/0TQmwl7D8kpk7CqfyX6u4 FEMSoOcMofekg== Received: by pali.im (Postfix) id 15203990; Wed, 2 Mar 2022 11:52:44 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese , =?utf-8?q?Marek_Beh=C3=BAn?= , Tony Dinh Cc: u-boot@lists.denx.de Subject: [PATCH u-boot-marvell 03/10] tools: kwboot: Cleanup bootmsg and debugmsg variables Date: Wed, 2 Mar 2022 11:49:20 +0100 Message-Id: <20220302104927.18607-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220302104927.18607-1-pali@kernel.org> References: <20220302104927.18607-1-pali@kernel.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.5 at phobos.denx.de X-Virus-Status: Clean Function kwboot_debugmsg() is always called with kwboot_msg_debug as msg and function kwboot_bootmsg() with kwboot_msg_debug as msg. Function kwboot_bootmsg() is never called with NULL msg. Simplify, cleanup and remove dead code. No functional change. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese Tested-by: Stefan Roese --- tools/kwboot.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 4dfb1038b4ff..4e2acb52458a 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -718,17 +718,14 @@ out: } static int -kwboot_bootmsg(int tty, void *msg) +kwboot_bootmsg(int tty) { struct kwboot_block block; int rc; char c; int count; - if (msg == NULL) - kwboot_printv("Please reboot the target into UART boot mode..."); - else - kwboot_printv("Sending boot message. Please reboot the target..."); + kwboot_printv("Sending boot message. Please reboot the target..."); do { rc = tcflush(tty, TCIOFLUSH); @@ -736,7 +733,7 @@ kwboot_bootmsg(int tty, void *msg) break; for (count = 0; count < 128; count++) { - rc = kwboot_tty_send(tty, msg, 8, 0); + rc = kwboot_tty_send(tty, kwboot_msg_boot, sizeof(kwboot_msg_boot), 0); if (rc) break; } @@ -798,7 +795,7 @@ kwboot_bootmsg(int tty, void *msg) } static int -kwboot_debugmsg(int tty, void *msg) +kwboot_debugmsg(int tty) { int rc; @@ -811,7 +808,7 @@ kwboot_debugmsg(int tty, void *msg) if (rc) break; - rc = kwboot_tty_send(tty, msg, 8, 0); + rc = kwboot_tty_send(tty, kwboot_msg_debug, sizeof(kwboot_msg_debug), 0); if (rc) break; @@ -1737,8 +1734,8 @@ main(int argc, char **argv) { const char *ttypath, *imgpath; int rv, rc, tty, term; - void *bootmsg; - void *debugmsg; + int bootmsg; + int debugmsg; void *img; size_t size; size_t after_img_rsv; @@ -1748,8 +1745,8 @@ main(int argc, char **argv) rv = 1; tty = -1; - bootmsg = NULL; - debugmsg = NULL; + bootmsg = 0; + debugmsg = 0; imgpath = NULL; img = NULL; term = 0; @@ -1771,7 +1768,7 @@ main(int argc, char **argv) case 'b': if (imgpath || bootmsg || debugmsg) goto usage; - bootmsg = kwboot_msg_boot; + bootmsg = 1; if (prev_optind == optind) goto usage; if (optind < argc - 1 && argv[optind] && argv[optind][0] != '-') @@ -1781,14 +1778,14 @@ main(int argc, char **argv) case 'D': if (imgpath || bootmsg || debugmsg) goto usage; - bootmsg = NULL; + bootmsg = 0; imgpath = optarg; break; case 'd': if (imgpath || bootmsg || debugmsg) goto usage; - debugmsg = kwboot_msg_debug; + debugmsg = 1; break; case 'p': @@ -1869,13 +1866,13 @@ main(int argc, char **argv) } if (debugmsg) { - rc = kwboot_debugmsg(tty, debugmsg); + rc = kwboot_debugmsg(tty); if (rc) { perror("debugmsg"); goto out; } } else if (bootmsg) { - rc = kwboot_bootmsg(tty, bootmsg); + rc = kwboot_bootmsg(tty); if (rc) { perror("bootmsg"); goto out;