From patchwork Wed Aug 14 10:59:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 819104 Delivered-To: patch@linaro.org Received: by 2002:adf:cd01:0:b0:367:895a:4699 with SMTP id w1csp644203wrm; Wed, 14 Aug 2024 04:00:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEQ7Khcn0yG9koZMk5SdbGOFlRrJlISIjDrZ+3pOjaeZXyzAs9kPfdYG8NyOIHFjx/OvwXCuJGgWWoLSdnR29B X-Google-Smtp-Source: AGHT+IF70VY5ysyYYxCUSyozDQ29Rczt5nVJMfBmFLRDEF8DH8b08UAY2CdnvIVCqqaswsizrgf8 X-Received: by 2002:a17:907:2d10:b0:a7d:2bf7:5619 with SMTP id a640c23a62f3a-a8367085413mr141157866b.58.1723633248108; Wed, 14 Aug 2024 04:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723633248; cv=none; d=google.com; s=arc-20160816; b=eo+fJJazoH+oP1hawudp2SRW6SUCcjqTBazSa3RDeic7hybRh/RrRfbjs5R0LYb2yU PjxGHBChJrRtjpfwpQuQaAPZ1tPlMfUZ6T5Xial+sedGGaKFwAB5Tw29Fu8u2TKPHM99 1tfNm9paomorKVATjYtO8rOPYv8Ef58XZ2qDSfQzlhFsf7hlsyKoS4+HyOJlZqxCohMB kOVeyjw37pO6QcFUvYoBE667anZBN8tc0AujkfEyM7WjTjYqlGfm+AtHPBn4hPGhW0P6 wxXziXESf/crWmZ6ficsjIdrBacYPDiquDs0z9DnYjGvbLSXf9xlynDnt2qV6KCe4J9t 3iFA== 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=2gi9KiCI5WUl/e/UuEOff0bdh1L2y6XFaw5SplpbBJU=; fh=w4WyT9xL7ErtT1TeetrD/m0Y0mAgjnERgxacGUpGjSg=; b=X4k5cxDJlV26WQsBnK5e7U42yMy8m6S7P18RLwWTjsv4LSsu0iNfHRk8h3Qj/UpAxq YV0JE5GNMaXRpuL7cPvepd8m9oOmOQTKWL8rkDrs2fVpp/r57MEa/2Ck/7FafpVFNrUI piO0K053dphW3w4OFGS4/e5hI1H/x+C0cfJTINGDNA1Nq2ErnHcLD/2A17tg2vKzZcu3 EIealvVOoO2fxx/8vfjBQceHVwSwnwd+CBnCMpTwXeSD1QoVo9tXQA4IiLwbg5ZXVZn/ Q/3hIfO/nTmf18pdGmsEjHRXLC/mkV3wmxAXZMQYeGpCjwQysbWM1AQs8bIB4fGP4PIt dWzg==; 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 a640c23a62f3a-a80f418acbdsi198939466b.893.2024.08.14.04.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 04:00:48 -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 CE3F5889DA; Wed, 14 Aug 2024 13:00:41 +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 2257F889B8; Wed, 14 Aug 2024 13:00:41 +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 68C2D889BA for ; Wed, 14 Aug 2024 13:00:37 +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 A47A5DA7; Wed, 14 Aug 2024 04:01:02 -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 305233F58B; Wed, 14 Aug 2024 04:00:31 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Tom Rini , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH v2 01/32] alist: add a helper to check if the list is full Date: Wed, 14 Aug 2024 16:29:38 +0530 Message-Id: <20240814110009.45310-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814110009.45310-1-sughosh.ganu@linaro.org> References: <20240814110009.45310-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 Add a helper function to check if the alist is full. This can then be used to extend the alist. Signed-off-by: Sughosh Ganu --- Changes since V1: * Do away with the alist_empty() function, as it is no longer needed include/alist.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/alist.h b/include/alist.h index 586a1efa5c..68d268f01a 100644 --- a/include/alist.h +++ b/include/alist.h @@ -82,6 +82,17 @@ static inline bool alist_err(struct alist *lst) return lst->flags & ALISTF_FAIL; } +/** + * alist_full() - Check if the alist is full + * + * @lst: List to check + * Return: true if full, false otherwise + */ +static inline bool alist_full(struct alist *lst) +{ + return lst->count == lst->alloc; +} + /** * alist_get_ptr() - Get the value of a pointer *