dm: use list_count_nodes() for counting list nodes

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 <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Sughosh Ganu
2024-07-30 16:41:32 +05:30
committed by Heinrich Schuchardt
parent e464ad085e
commit 939afc80b6
5 changed files with 13 additions and 28 deletions

View File

@@ -3,23 +3,13 @@
* Copyright (c) 2013 Google, Inc
*/
#include <vsprintf.h>
#include <dm/device.h>
#include <dm/ofnode.h>
#include <dm/read.h>
#include <dm/util.h>
#include <linux/libfdt.h>
#include <vsprintf.h>
int list_count_items(struct list_head *head)
{
struct list_head *node;
int count = 0;
list_for_each(node, head)
count++;
return count;
}
#include <linux/list.h>
#if CONFIG_IS_ENABLED(OF_REAL)
int pci_get_devfn(struct udevice *dev)