From mboxrd@z Thu Jan 1 00:00:00 1970 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 C1663C28B2E for ; Thu, 13 Mar 2025 11:55:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22F36817EC; Thu, 13 Mar 2025 12:55:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com 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=ti.com header.i=@ti.com header.b="c2kwqoVr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C9AE38169D; Thu, 13 Mar 2025 12:55:24 +0100 (CET) Received: from lelvem-ot01.ext.ti.com (lelvem-ot01.ext.ti.com [198.47.23.234]) (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 8696E80F9C for ; Thu, 13 Mar 2025 12:55:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=f-akthar@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelvem-ot01.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52DBtKBi1374137 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Mar 2025 06:55:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1741866920; bh=r2B+V35vd7FQQUhwOr83M2HCFgsjGKw6qod6QwnZnWc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=c2kwqoVrr8593E9BV0D3QxuHR51LajYGAlNi98jqXsfHCzjKvw7Y+SM1XiqLtgIY2 25n80watxIb9upzZwLNPKOoqKpjofHKaj0kgotsyc8lW8VRwaURKyvOf1Gsg5S/zoX r6b851oFOqDhVVTRVhd5OkO2sJz1aQ1e7hmnyD1E= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 52DBtKIH097075 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 13 Mar 2025 06:55:20 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 13 Mar 2025 06:55:20 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 13 Mar 2025 06:55:20 -0500 Received: from localhost (fayaz-hp-z2-tower-g4-workstation.dhcp.ti.com [172.24.227.128]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52DBtJnx035209; Thu, 13 Mar 2025 06:55:20 -0500 From: Harsha Vardhan V M To: CC: Subject: [RFC PATCH 1/4] cmd: fuse: Remove custom string functions Date: Thu, 13 Mar 2025 17:25:14 +0530 Message-ID: <20250313115517.1181829-2-h-vm@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250313115517.1181829-1-h-vm@ti.com> References: <20250313115517.1181829-1-h-vm@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea 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 Remove custom string functions and replace them with normal string functions. Remove the custom strtou32 and replace it with str2long. Signed-off-by: Harsha Vardhan V M --- cmd/fuse.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/cmd/fuse.c b/cmd/fuse.c index 598ef496a43..9f489570634 100644 --- a/cmd/fuse.c +++ b/cmd/fuse.c @@ -15,17 +15,6 @@ #include #include -static int strtou32(const char *str, unsigned int base, u32 *result) -{ - char *ep; - - *result = simple_strtoul(str, &ep, base); - if (ep == str || *ep != '\0') - return -EINVAL; - - return 0; -} - static int confirm_prog(void) { puts("Warning: Programming fuses is an irreversible operation!\n" @@ -54,14 +43,14 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, argc -= 2 + confirmed; argv += 2 + confirmed; - if (argc < 2 || strtou32(argv[0], 0, &bank) || - strtou32(argv[1], 0, &word)) + if (argc < 2 || !(str2long(argv[0], (ulong *)&bank)) || + !(str2long(argv[1], (ulong *)&word))) return CMD_RET_USAGE; if (!strcmp(op, "read")) { if (argc == 2) cnt = 1; - else if (argc != 3 || strtou32(argv[2], 0, &cnt)) + else if (argc != 3 || !(str2long(argv[2], (ulong *)&cnt))) return CMD_RET_USAGE; printf("Reading bank %u:\n", bank); @@ -79,7 +68,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, } else if (!strcmp(op, "readm")) { if (argc == 3) cnt = 1; - else if (argc != 4 || strtou32(argv[3], 0, &cnt)) + else if (argc != 4 || !(str2long(argv[3], (ulong *)&cnt))) return CMD_RET_USAGE; addr = simple_strtoul(argv[2], NULL, 16); @@ -99,7 +88,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, unmap_sysmem(start); } else if (!strcmp(op, "cmp")) { - if (argc != 3 || strtou32(argv[2], 0, &cmp)) + if (argc != 3 || !(str2long(argv[2], (ulong *)&cmp))) return CMD_RET_USAGE; printf("Comparing bank %u:\n", bank); @@ -119,7 +108,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, } else if (!strcmp(op, "sense")) { if (argc == 2) cnt = 1; - else if (argc != 3 || strtou32(argv[2], 0, &cnt)) + else if (argc != 3 || !(str2long(argv[2], (ulong *)&cnt))) return CMD_RET_USAGE; printf("Sensing bank %u:\n", bank); @@ -139,7 +128,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_USAGE; for (i = 2; i < argc; i++, word++) { - if (strtou32(argv[i], 16, &val)) + if (!(str2long(argv[i], (ulong *)&val))) return CMD_RET_USAGE; printf("Programming bank %u word 0x%.8x to 0x%.8x...\n", @@ -155,7 +144,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_USAGE; for (i = 2; i < argc; i++, word++) { - if (strtou32(argv[i], 16, &val)) + if (!(str2long(argv[i], (ulong *)&val))) return CMD_RET_USAGE; printf("Overriding bank %u word 0x%.8x with " -- 2.34.1