From patchwork Wed Aug 21 10:58:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 820954 Delivered-To: patch@linaro.org Received: by 2002:adf:e98a:0:b0:367:895a:4699 with SMTP id h10csp639171wrm; Wed, 21 Aug 2024 03:59:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7SAHIIulatR/q2wpSCSawwuXoOJN78v/p1wnw0iECkrlLzKj+BIuzO0t4ODbpyu6YuMgEYQ==@linaro.org X-Google-Smtp-Source: AGHT+IHBGBp397ImdsFhTdev/mvjNRaj562gZYgkg9uHQyn4y3ikp+XPVcbNMdzIGTiy++3eQceo X-Received: by 2002:a05:6402:1ec8:b0:5be:fb2e:d334 with SMTP id 4fb4d7f45d1cf-5bf1e748d4amr1743089a12.12.1724237976159; Wed, 21 Aug 2024 03:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724237976; cv=none; d=google.com; s=arc-20160816; b=g4yKzemQg0TVfIbSFtLQ3w4aRfyRhW0GFAq5GsIgRk8WpBc6Bm9bgtFOX5C1AC+Ktw fyez3/A51p9vZ+bhhqABcvwQC7pUu5WEekBV5EEqVQ6nbk16JRqal1wSUQ02lJbeyF7P 5pCDDGwPIHn/mBKyeaGgsFnYMslIgrAF+FlOeHZB4AU13kQ3mn0XYfBbwpjPyI5y692p I+Fz0UhtoYtctA1uV/vAPhk+JhRn2PMO6bfQeXXqXL0hrqCY/7ir+wKFNPDlB7QsZxfd nCb5gJuN+2mYz6ewwCzdTHdFkk7UrLFUh0APDGYM675glQ07oqpCZ44AwXQ8CMVtDvdV +tPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=drU+6M5tIdBFPCsVwUCwEOtVEKJMNAVbLOEjfZPzY38=; fh=pnMZGD6unUPoMrkOwzXlkuYg+kVwGnSNRCTlQoWqjVc=; b=1DH+S8a1duoQFzLMfGPINMh2XAVKc6RUd/lhHMIBVBdR7jl/Ec+vJUdqZmXR5RssPp lOx77Rink5AKs9YU5+K1a3Z9EUonx8WQjMATMkfTWTATmNxV0JMHIX/E/5qFpxMt6vAK zV61Gtx0JggV6OIK5zCNwHqn4idi6f/KmecTZk+h0bEuYI/XwCZYM0VDQ9rFKeDZdYjR bdfWSiC3mhNr1/Uq9hCwqUSEiUqdzymnp0LlA9l/M/vKGc0AcIOzt/bH5810JfS7BLcM Ti4jb7Qz7+7vO/qXvBcQJsTqgKNlPBb1jTbFkA4jvi/1KqndY1TzvMXy5LU0Mt0rgcmQ 09FQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5bec254709dsi8105084a12.295.2024.08.21.03.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 03:59:36 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C934D88C04; Wed, 21 Aug 2024 12:59:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9551288C04; Wed, 21 Aug 2024 12:59:11 +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.2 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 72C5488C20 for ; Wed, 21 Aug 2024 12:59:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E8583DA7; Wed, 21 Aug 2024 03:59:34 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 877493F73B; Wed, 21 Aug 2024 03:59:05 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Marek Vasut , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Sughosh Ganu Subject: [PATCH v3 03/27] lmb: staticize __lmb_alloc_base() Date: Wed, 21 Aug 2024 16:28:15 +0530 Message-Id: <20240821105839.2870293-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821105839.2870293-1-sughosh.ganu@linaro.org> References: <20240821105839.2870293-1-sughosh.ganu@linaro.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 __lmb_alloc_base() function is only called from within the lmb module. Moreover, the lmb_alloc() and lmb_alloc_base() API's are good enough for the allocation API calls. Make the __lmb_alloc_base() function static. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V2: None include/lmb.h | 2 -- lib/lmb.c | 39 ++++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index 6c50d93e83..7b87181b9e 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -112,8 +112,6 @@ long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base, phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align); phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phys_addr_t max_addr); -phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, - phys_addr_t max_addr); phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, phys_size_t size); phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr); diff --git a/lib/lmb.c b/lib/lmb.c index adc3abd5b4..4d39c0d1f9 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -435,30 +435,13 @@ static long lmb_overlaps_region(struct lmb_region *rgn, phys_addr_t base, return (i < rgn->cnt) ? i : -1; } -phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align) -{ - return lmb_alloc_base(lmb, size, align, LMB_ALLOC_ANYWHERE); -} - -phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phys_addr_t max_addr) -{ - phys_addr_t alloc; - - alloc = __lmb_alloc_base(lmb, size, align, max_addr); - - if (alloc == 0) - printf("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n", - (ulong)size, (ulong)max_addr); - - return alloc; -} - static phys_addr_t lmb_align_down(phys_addr_t addr, phys_size_t size) { return addr & ~(size - 1); } -phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phys_addr_t max_addr) +static phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, + ulong align, phys_addr_t max_addr) { long i, rgn; phys_addr_t base = 0; @@ -499,6 +482,24 @@ phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phy return 0; } +phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align) +{ + return lmb_alloc_base(lmb, size, align, LMB_ALLOC_ANYWHERE); +} + +phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phys_addr_t max_addr) +{ + phys_addr_t alloc; + + alloc = __lmb_alloc_base(lmb, size, align, max_addr); + + if (alloc == 0) + printf("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n", + (ulong)size, (ulong)max_addr); + + return alloc; +} + /* * Try to allocate a specific address range: must be in defined memory but not * reserved