mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 18:04:48 +00:00

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>
30 lines
585 B
C
30 lines
585 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* 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 <linux/list.h>
|
|
|
|
#if CONFIG_IS_ENABLED(OF_REAL)
|
|
int pci_get_devfn(struct udevice *dev)
|
|
{
|
|
struct fdt_pci_addr addr;
|
|
int ret;
|
|
|
|
/* Extract the devfn from fdt_pci_addr */
|
|
ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
|
|
"reg", &addr, NULL);
|
|
if (ret) {
|
|
if (ret != -ENOENT)
|
|
return -EINVAL;
|
|
}
|
|
|
|
return addr.phys_hi & 0xff00;
|
|
}
|
|
#endif
|