From patchwork Tue Jul 30 11:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 815300 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp242709wrs; Tue, 30 Jul 2024 04:12:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSaEN1aMgeusfv0ohD8GkDyvfyd+dBUyvnOmA3t7jjEQinp9laNQ7PQk7lZBmnL7MRG8+4dhGQUDJIBge5umX4 X-Google-Smtp-Source: AGHT+IHKDxzl9OBxKt9DgMyqMrsYcTUdessSkJlKxnHPdNR5FeAF6r/UCnr80psvwEKKwHW2pNKO X-Received: by 2002:a50:8713:0:b0:5a1:b0b2:798d with SMTP id 4fb4d7f45d1cf-5b0224ceed5mr6559451a12.25.1722337920039; Tue, 30 Jul 2024 04:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722337920; cv=none; d=google.com; s=arc-20160816; b=cQdTAmNgi2m5YHRsMBPz3kWbVj+/ioPsvQmMRDs22dNKJmXWObSNJJnDBmY1zd8g/e gWxahztWLR69uUNMt8zdS2XzTNl1GDB/CGwdZNodc9Rjdz6dF3rnfZt3+Em5gJkR57So JuTSVsG2f96Xzq2OIgK9wrYdN2Lt6y6kSjLJ2rALdTGooKKKPSNQNIWbJXVEM2VYdb4h /abWqADVGV9mAGOIhN6kJDd7qi0eXQp0mYlkfnEeMs6ovMLGhkSZzkzizHyT+dh94YXW 4C5daL1R1P1AMWF2GWuAxYDldvES+LEpYIsq3YPW9fclixUStqAoUN/cZJL0Zae2QLp7 5P+A== 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:message-id:date:subject:cc:to:from; bh=4E+/ky8Pu8U93oZVFfQhvZKQNmIq2Bk7nEvYQhwQRxw=; fh=c60fu1IChZaOc2lQYQAOoRysAfBqXosZh6e58mdWpwk=; b=ytY4k/imiSazf62FhnETDmu0wa7KZibTIWfb9xAQpOJfgEoo/hlmI98fEHcNtxj4g9 /xvM9CUt/x6aCDcVU7OOYImH1FAf48hJ5xnGtD43l0FsbxczHnOF3B1OAi97izPmsScS rURwXdGEhL9cMr3JFblojywsKS3DgXJRFjKs54VkYxjNX2cjwgw9cP7CI2FH5HTFj9bc 1+Ap5/r6S1ElLLA0rDszq/zKV6MdneVFpnPHF72mmT43F8M1WoTdVYjVk4EqcqKVpBB3 LWFEh+TJtECM+55dFYXbVhfnMGaKU9fzI48YSYs00CJWBSLJo5ONLg8IObuC1Du+O+2t 6vyQ==; 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-5ac65f3c5cbsi7605615a12.561.2024.07.30.04.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 04:12:00 -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 C9331887FF; Tue, 30 Jul 2024 13:11:58 +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 98C26887E8; Tue, 30 Jul 2024 13:11:57 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 8F3468780A for ; Tue, 30 Jul 2024 13:11:55 +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 96BCD1007; Tue, 30 Jul 2024 04:12:20 -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 4CE663F5A1; Tue, 30 Jul 2024 04:11:53 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 1/5] linux: list: add a function to count list nodes Date: Tue, 30 Jul 2024 16:41:28 +0530 Message-Id: <20240730111132.1097315-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 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 function to count the nodes of a list. Taken from linux 6.11-rc1 tag commit 8400291e289e. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- include/linux/list.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/list.h b/include/linux/list.h index 6910721c00..0f9d939b05 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -547,6 +547,21 @@ static inline void list_splice_tail_init(struct list_head *list, &pos->member != (head); \ pos = n, n = list_entry(n->member.prev, typeof(*n), member)) +/** + * list_count_nodes - count nodes in the list + * @head: the head for your list. + */ +static inline size_t list_count_nodes(struct list_head *head) +{ + struct list_head *pos; + size_t count = 0; + + list_for_each(pos, head) + count++; + + return count; +} + /* * Double linked lists with a single pointer list head. * Mostly useful for hash tables where the two pointer list head is From patchwork Tue Jul 30 11:11:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 815301 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp242765wrs; Tue, 30 Jul 2024 04:12:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXdCdHg4QlCqyJlasPXDHavWotP9iOKFqjyttCkAj7bTSX6fC/S04Rwy0G+Cn5V++SSZ5YEsM/tCaY/IwHNsL0c X-Google-Smtp-Source: AGHT+IHodk+KcTKjyBgYIeeF8kxzxIxEw2Q+xYPCXFbihuTdJrLYpHPxnW4QRQ8LyZBt0XnPKMcs X-Received: by 2002:a17:907:86a7:b0:a7a:a2e3:3739 with SMTP id a640c23a62f3a-a7d8595e547mr175745566b.20.1722337930172; Tue, 30 Jul 2024 04:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722337930; cv=none; d=google.com; s=arc-20160816; b=yd7UctWhe6DwjV3cpb0u2SOIdlqYgFxRpVVnVPX1E0V9I0KN0X/bJzNyBir7WlVvKm aHvgHapMIaBRxwOxjytozsqE0ItDbBODIXhbICO7PxoOOF8LLg0BQxagcnv8jvdAW+X+ tp51alxIdKTBAuT4399BjgnJPT/7BSYbG1izL3PSeaMw5yywAq7vePzBz/q9j6hnwSy+ BGd6a+q3lOTTNE1HfIVoZ2fiwoGQLArsJCV60vsRb+hDDPBH3sEoBH+iScAIsGGX1hOS PYdhNSRzIKUP3RtnD2Qztys8uUv/oU5sUBRAOanricIvDvSbJbX+WzrIZn1gUI2pT9cq A6AA== 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=GVEt5U2ofd0uufSq0NLuIhDd3uNoV3soBMY7bT6CEcY=; fh=c60fu1IChZaOc2lQYQAOoRysAfBqXosZh6e58mdWpwk=; b=qoHVuiiJ//Ss4YfZJ/60Yrz8CgZHyMfan92Of6aMOtirw4SB8bjy82e69R5va4DIAf uJj4uIBvuu2VqpEcqFhSDB9NzG9flIOLyzOSRbu5ZFGJ7PYMXJnphB0Zdksm8oU8dqt2 UcIMLTMdbvYWWI6hp7CGfRtn7rYsT+8m9WiUjG+CgffgnLG8dh2YZMpc06t+WtITTwke XVKWqQAJ+VX6Mt2JQldixm5L4jZLQk6mIeMW9xeDQVj6X/x4l1G0/yyu55hF5yXNpOli r/x4vascBQThYuRIDtxROZTHpVwNCk9yVtB6DfRW5Rw1OYXgQzbbFH+/nYUT8juMpRSA eS+Q==; 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-a7acab3d01dsi746340266b.470.2024.07.30.04.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 04:12:10 -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 3D6ED887E4; Tue, 30 Jul 2024 13:12:01 +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 A1E50887BF; Tue, 30 Jul 2024 13:11:59 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 B4C9987A55 for ; Tue, 30 Jul 2024 13:11:57 +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 C622B1007; Tue, 30 Jul 2024 04:12:22 -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 7CF983F5A1; Tue, 30 Jul 2024 04:11:55 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 2/5] efi_memory: use list_count_nodes() to count list entries Date: Tue, 30 Jul 2024 16:41:29 +0530 Message-Id: <20240730111132.1097315-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240730111132.1097315-1-sughosh.ganu@linaro.org> References: <20240730111132.1097315-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 Use the API function list_count_nodes() to count the number of EFI memory map entries. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass --- lib/efi_loader/efi_memory.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 12cf23fa3f..bfadd6bd41 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -742,8 +742,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, efi_uintn_t *descriptor_size, uint32_t *descriptor_version) { + int map_entries; efi_uintn_t map_size = 0; - int map_entries = 0; struct list_head *lhandle; efi_uintn_t provided_map_size; @@ -752,8 +752,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, provided_map_size = *memory_map_size; - list_for_each(lhandle, &efi_mem) - map_entries++; + map_entries = list_count_nodes(&efi_mem); map_size = map_entries * sizeof(struct efi_mem_desc); From patchwork Tue Jul 30 11:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 815302 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp242840wrs; Tue, 30 Jul 2024 04:12:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWE2jkOmwNU0HtrCS8LIJprBTj5RR+YHfQePdenqVcRhK12vjDDMUPKPfBACUlHNg5j81K+w2Auhubc7yVXjlDY X-Google-Smtp-Source: AGHT+IH+ZMHJqXer+SGHDDdHqjOX2mZRrCSbU/NCaVDyaGM0hUlp1B1/P7XiqTbyK1FaGyIELAE3 X-Received: by 2002:a17:907:3da8:b0:a7a:a892:8e05 with SMTP id a640c23a62f3a-a7d3ff9e775mr916239166b.33.1722337939841; Tue, 30 Jul 2024 04:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722337939; cv=none; d=google.com; s=arc-20160816; b=OWyO9yoexYS/qRASj7OMyp/6skdAtaoLJzYY/cSkJWGMYiZNSui45XIvRlhnSxCi91 iVtKe2+dC8Qh51c9jDCWoQpe8qXWZe0AgN41JYoDzeFn2mr2gHk5uT2baeylSN3y78Cu DmoaN9w4FHdVex2EhY37nIBnjN9galmGPEzHCl5OdFQq8MhlYtUOAAh7bhcTAc4LRZzP mvx2/oKiqBK54fVfS8Oh23/4Y3G/ZhAdL2sox1cvr8AyDoT8wrUfCzWyBbobusSjc9bN umW74ewZ3NXKlurkfgxnPf0vo6ZGzFLccUdcjxYU3IbNcwZ/eq0x+Mumaiqk5MH7jv+F /hIw== 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=+eXAiokIiec04FrwfY3zW21rpc5HUPUNthsFPOsIlMs=; fh=c60fu1IChZaOc2lQYQAOoRysAfBqXosZh6e58mdWpwk=; b=hAdzlqmfPVGDZrAMfams7X0Z/vuT8bQ7nXQUz+/Ul+hvvTsS6/FnERl0CYX9bE9wyH vL4RlQQwpyAmuRQAMvL0Gsr8AMEJH6lQlQ/qH22x0iEMIOgw0EHz05RVv+miIjX05mzr Mbb6a3d9jsfxCfXc/5gy01NgyJd/7LzA8a5fwUhWxMEcTOwRleyeMDbu9gaQ/q2RlK6L DGRUA/jcrz3wYPJu6zs6sAWL+gmINhnl89MHJa3B5PwEFTidgtg4sq3Gf9iDwYQQ4Lce DjCsLsv8G5dUpGGUTpzUmr02qe8KH2UQ+KEz8rF95Wxe39CBT1PKux9NkHdggrCNh4pb terg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a7acac69516si788927766b.667.2024.07.30.04.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 04:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 CBC768882F; Tue, 30 Jul 2024 13:12:02 +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 025118881D; Tue, 30 Jul 2024 13:12:02 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 10A978780A for ; Tue, 30 Jul 2024 13:11:59 +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 01B6B1007; Tue, 30 Jul 2024 04:12:25 -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 AC88F3F5A1; Tue, 30 Jul 2024 04:11:57 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 3/5] efi_memory: avoid possible null pointer dereference Date: Tue, 30 Jul 2024 16:41:30 +0530 Message-Id: <20240730111132.1097315-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240730111132.1097315-1-sughosh.ganu@linaro.org> References: <20240730111132.1097315-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 Populate the previous memory descriptor node pointer only after it's parent struct has been initialised. The compiler fixes this logic to do the right thing, but it is better to have correct code in place. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index bfadd6bd41..8d4f6e339d 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -138,7 +138,7 @@ static void efi_mem_sort(void) merge_again = false; list_for_each(lhandle, &efi_mem) { struct efi_mem_list *lmem; - struct efi_mem_desc *prev = &prevmem->desc; + struct efi_mem_desc *prev; struct efi_mem_desc *cur; uint64_t pages; @@ -149,6 +149,7 @@ static void efi_mem_sort(void) } cur = &lmem->desc; + prev = &prevmem->desc; if ((desc_get_end(cur) == prev->physical_start) && (prev->type == cur->type) && From patchwork Tue Jul 30 11:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 815303 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp242881wrs; Tue, 30 Jul 2024 04:12:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX3f3YXqCmdRsn1mD00lOwtR+xQwwE++1pQKNQ3Tj3qmhHzrrnelnA/H49qc3Ch6mwJlDhh4Y0+6S9xSrEJx48+ X-Google-Smtp-Source: AGHT+IFsCQJyOSEqh4K1GJBFDK9tU6x76cA5nohBiw/6LupIBXBlZSirXrM8zmDsKg/hJFmV/bl9 X-Received: by 2002:a05:6512:1052:b0:52e:9882:2cd8 with SMTP id 2adb3069b0e04-5309b26984fmr8728655e87.4.1722337949254; Tue, 30 Jul 2024 04:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722337949; cv=none; d=google.com; s=arc-20160816; b=B6gz7GcX//Eb0NKR108j6mL9TJlm2zTcAkIzJ6zGnRQi6DPZ56Ou56WYhfmvvSPYQi lWTEr+eQyLj3JfUpMmN44f2kDdlbiL9HeEAnDdSm4FFDMVxYQ5PSNC0fKG/sv4/tXfOs xwemMI9L5dibzhCl0zB0Egu7rXn0pTah19xxaUb/fcH0QWiNxgR4yHI5jBG8GoeXnnvP SWSWtgYsK8C7qfVbje3Uf02odc649Rpfcl5DROWIBPmZf+65ULp3rFTnCjh8TgMEdtS0 Fzbhcp9mFnTA92S4A92qnwJ4npiVIrMoqNg7o5oMeETAtgr28FRiha5MP9J/JHj/AkDn PKpQ== 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=QRunljcUp2lS50AxiFegUEub9hR9BRlKZe4lBtqjy9o=; fh=c60fu1IChZaOc2lQYQAOoRysAfBqXosZh6e58mdWpwk=; b=Z12TkoGlJ5bWO1Z/sSiuz0J3Pzdgqk4zXpy8ny7lmQniZAUkOEqLD4x8WlqK7JMmm5 uAvoXk33/FtH0FhZVpHxt/tV8hlZIlvxa/Rdtj8M732Sfi83zITWWvBJ3aHqwegj6tpS cY8ZL5TCxYtrVUgKrJpd1HxTdk3J8SAQsom9PXdxknf6KDL//ZGpSBihrDG+hnka2QCN wFuBjweBzM7GwKx+JRXGVk/sNa/dcUB37X1RItjCmbM18KwoJX2HlpjIKPcrjR5L4Kmf eNKhzzsAlAwNKpa9S5wO9fzPS79ByNys6+GdptLC0h1tWg4A0uafQotUCZ9VFfXIQ8Z5 dI7w==; 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-a7acacc50ddsi755589466b.1025.2024.07.30.04.12.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 04:12:29 -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 39C1F8881F; Tue, 30 Jul 2024 13:12:05 +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 65B0C8881F; Tue, 30 Jul 2024 13:12:04 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 31EEE87A55 for ; Tue, 30 Jul 2024 13:12:02 +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 316561007; Tue, 30 Jul 2024 04:12:27 -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 DC84A3F5A1; Tue, 30 Jul 2024 04:11:59 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 4/5] efi_memory: get the efi_mem_list node directly Date: Tue, 30 Jul 2024 16:41:31 +0530 Message-Id: <20240730111132.1097315-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240730111132.1097315-1-sughosh.ganu@linaro.org> References: <20240730111132.1097315-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 Use the list_for_each_entry() API to get the efi_mem_list node directly, instead of making an additional call to list_entry(). Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_memory.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 8d4f6e339d..6819c2ec90 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -127,7 +127,7 @@ static uint64_t desc_get_end(struct efi_mem_desc *desc) */ static void efi_mem_sort(void) { - struct list_head *lhandle; + struct efi_mem_list *lmem; struct efi_mem_list *prevmem = NULL; bool merge_again = true; @@ -136,13 +136,11 @@ static void efi_mem_sort(void) /* Now merge entries that can be merged */ while (merge_again) { merge_again = false; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; + list_for_each_entry(lmem, &efi_mem, link) { struct efi_mem_desc *prev; struct efi_mem_desc *cur; uint64_t pages; - lmem = list_entry(lhandle, struct efi_mem_list, link); if (!prevmem) { prevmem = lmem; continue; @@ -269,7 +267,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, int memory_type, bool overlap_only_ram) { - struct list_head *lhandle; + struct efi_mem_list *lmem; struct efi_mem_list *newlist; bool carve_again; uint64_t carved_pages = 0; @@ -309,11 +307,9 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, /* Add our new map */ do { carve_again = false; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; + list_for_each_entry(lmem, &efi_mem, link) { s64 r; - lmem = list_entry(lhandle, struct efi_mem_list, link); r = efi_mem_carve_out(lmem, &newlist->desc, overlap_only_ram); switch (r) { @@ -445,7 +441,7 @@ static efi_status_t efi_check_allocated(u64 addr, bool must_be_allocated) */ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) { - struct list_head *lhandle; + struct efi_mem_list *lmem; /* * Prealign input max address, so we simplify our matching @@ -453,9 +449,7 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) */ max_addr &= ~EFI_PAGE_MASK; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem = list_entry(lhandle, - struct efi_mem_list, link); + list_for_each_entry(lmem, &efi_mem, link) { struct efi_mem_desc *desc = &lmem->desc; uint64_t desc_len = desc->num_pages << EFI_PAGE_SHIFT; uint64_t desc_end = desc->physical_start + desc_len; @@ -745,7 +739,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, { int map_entries; efi_uintn_t map_size = 0; - struct list_head *lhandle; + struct efi_mem_list *lmem; efi_uintn_t provided_map_size; if (!memory_map_size) @@ -774,10 +768,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, /* Copy list into array */ /* Return the list in ascending order */ memory_map = &memory_map[map_entries - 1]; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; - - lmem = list_entry(lhandle, struct efi_mem_list, link); + list_for_each_entry(lmem, &efi_mem, link) { *memory_map = lmem->desc; memory_map--; } From patchwork Tue Jul 30 11:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 815304 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp242963wrs; Tue, 30 Jul 2024 04:12:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVSW04pUUes7lbMWy7tDm3caprHEQZo7a6mfE14ykJVtZH8R70R7jzFWKUwmp4f4l9YzwCNXvxDmkh/1YWjqU6U X-Google-Smtp-Source: AGHT+IF5fZME5UFbk7oP5u0WxR65zFrfh/wTcvg8GKmoLOIIILeo7ATmJWyFZQbj9vmRNuHH0utB X-Received: by 2002:a17:907:3eaa:b0:a7a:a7b8:adb1 with SMTP id a640c23a62f3a-a7d40073465mr729103366b.36.1722337959236; Tue, 30 Jul 2024 04:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722337959; cv=none; d=google.com; s=arc-20160816; b=K3NZr7BKEc9k2NUafjokr087dMJhO+W/K4IxUeFm78p/0ZD31N2asjSneyPpvb+IVG u0rg+1U8tBle2dQA4+3ZzmqHe3Xl+beAIfzluWMuykkzS10OftDYBIT92GCLErsJ1C9S 9fZ2LT2N16Tr8hpn28aEf+XCjI5r04TevDVESPavD8K+/RIyRUPxSw5T0mg8UHSax3S0 Du4hAg9oYZbuv/gc/zcOMuDMLo7MguBgSaJ8pgL8PNqr0cTc5rSJNvoycu8Fr/7PnDP8 g6T+UQxONmdEIjmMeXSbLUugoN5+iAxKVB6T9Q2c8OvPBj2nxJD1dKtYuBcXbYHssI76 cEZQ== 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=Jx+nLp6Woit5hLSa4PYJWnkr7dFQ1W+mkFVFVjbEUHA=; fh=c60fu1IChZaOc2lQYQAOoRysAfBqXosZh6e58mdWpwk=; b=y/vldxq0XbVtHTEIP3bEvYZvDv4VuMNdB8skHpd6cy97WcgsidGUZZD1eXMT5UPlux pxi4vyfEHVyMinfTk0tgQqEnnLo0z5t+mvNrgvqBfSkUgxKLzl32fcJQc31BZwzW4yLB hQ9RGH0/f1b9CqeB0jraTgcoVrZrgtHWO3WkYC8cxHnw5R3XJxbLHg2SG+uSaiasRiIL 12NsOLmltUBaTempkaDF6+2MJZErFaf2depggZWQbdmSFwRjhmvxyzfkIrYSQPKl/fn7 7jO9AGc3wsO8DECAbtzO8FVMcpj3v/TU6ZMa35VJeY9Tusl7Y8C4ccaEJx1MF73Vap5G gqrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a7acac63dd0si775747566b.649.2024.07.30.04.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 04:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 97F5288827; Tue, 30 Jul 2024 13:12:07 +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 6F07A8881D; Tue, 30 Jul 2024 13:12:06 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 46E8288860 for ; Tue, 30 Jul 2024 13:12:04 +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 60F381007; Tue, 30 Jul 2024 04:12:29 -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 175AA3F5A1; Tue, 30 Jul 2024 04:12:01 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 5/5] dm: use list_count_nodes() for counting list nodes Date: Tue, 30 Jul 2024 16:41:32 +0530 Message-Id: <20240730111132.1097315-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240730111132.1097315-1-sughosh.ganu@linaro.org> References: <20240730111132.1097315-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 linux kernel has the list_count_nodes() API functions which is used for counting nodes of a list. This has now been imported in U-Boot as part of an earlier commit. Use this function and drop the list_count_items(). Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- drivers/core/util.c | 14 ++------------ include/dm/util.h | 8 -------- test/dm/bus.c | 5 +++-- test/dm/core.c | 9 +++++---- test/dm/test-fdt.c | 5 +++-- 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/drivers/core/util.c b/drivers/core/util.c index 108a3bc4da..fa893485a0 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -3,23 +3,13 @@ * Copyright (c) 2013 Google, Inc */ +#include #include #include #include #include #include -#include - -int list_count_items(struct list_head *head) -{ - struct list_head *node; - int count = 0; - - list_for_each(node, head) - count++; - - return count; -} +#include #if CONFIG_IS_ENABLED(OF_REAL) int pci_get_devfn(struct udevice *dev) diff --git a/include/dm/util.h b/include/dm/util.h index 95c3527a37..ec518c51d9 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -16,14 +16,6 @@ struct dm_stats; struct list_head; -/** - * list_count_items() - Count number of items in a list - * - * @param head: Head of list - * Return: number of items, or 0 if empty - */ -int list_count_items(struct list_head *head); - /** * Dump out a tree of all devices starting @uclass * diff --git a/test/dm/bus.c b/test/dm/bus.c index a338c7f567..95326f23da 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -27,14 +28,14 @@ static int dm_test_bus_children(struct unit_test_state *uts) struct uclass *uc; ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); /* Probe the bus, which should yield 3 more devices */ ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); num_devices += 3; ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); ut_assert(!dm_check_devices(uts, num_devices)); diff --git a/test/dm/core.c b/test/dm/core.c index dbad1b317d..5bc5e8e82e 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -123,15 +124,15 @@ static int dm_test_autobind(struct unit_test_state *uts) * device with no children. */ ut_assert(uts->root); - ut_asserteq(1, list_count_items(gd->uclass_root)); - ut_asserteq(0, list_count_items(&gd->dm_root->child_head)); + ut_asserteq(1, list_count_nodes(gd->uclass_root)); + ut_asserteq(0, list_count_nodes(&gd->dm_root->child_head)); ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); ut_assertok(dm_scan_plat(false)); /* We should have our test class now at least, plus more children */ - ut_assert(1 < list_count_items(gd->uclass_root)); - ut_assert(0 < list_count_items(&gd->dm_root->child_head)); + ut_assert(1 < list_count_nodes(gd->uclass_root)); + ut_assert(0 < list_count_nodes(&gd->dm_root->child_head)); /* Our 3 dm_test_infox children should be bound to the test uclass */ ut_asserteq(3, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 18c89eef43..31effff59c 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -162,7 +163,7 @@ static int dm_test_fdt(struct unit_test_state *uts) ut_assert(!ret); /* These are num_devices compatible root-level device tree nodes */ - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); /* Each should have platform data but no private data */ for (i = 0; i < num_devices; i++) { @@ -217,7 +218,7 @@ static int dm_test_fdt_pre_reloc(struct unit_test_state *uts) * one with "bootph-all" property (a-test node), and the other * one whose driver marked with DM_FLAG_PRE_RELOC flag (h-test node). */ - ut_asserteq(2, list_count_items(&uc->dev_head)); + ut_asserteq(2, list_count_nodes(&uc->dev_head)); return 0; }