diff mbox

[1/3] hw/npu: Get number of links from NPU node property

Message ID 1467775203-12132-1-git-send-email-gwshan@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Gavin Shan July 6, 2016, 3:20 a.m. UTC
The NPU device node property "ibm,npu-links" indicates number of
NPU links supported. This retrieves the number of links from the
properties instead of counting its child device nodes.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 hw/npu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Stewart Smith July 20, 2016, 8:26 a.m. UTC | #1
Gavin Shan <gwshan@linux.vnet.ibm.com> writes:
> The NPU device node property "ibm,npu-links" indicates number of
> NPU links supported. This retrieves the number of links from the
> properties instead of counting its child device nodes.
>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  hw/npu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Thanks, series merged to master as of d0030c1a39eb1ef47f01d5557a1d45a642cc1518
diff mbox

Patch

diff --git a/hw/npu.c b/hw/npu.c
index 8eb8ab2..c1b1975 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1089,7 +1089,7 @@  static void npu_probe_phb(struct dt_node *dn)
 	struct dt_node *np;
 	uint32_t gcid, index, phb_index, xscom;
 	uint64_t at_bar[2], mm_win[2], val;
-	uint32_t links = 0;
+	uint32_t links;
 	char *path;
 
 	/* Retrieve chip id */
@@ -1097,9 +1097,7 @@  static void npu_probe_phb(struct dt_node *dn)
 	gcid = dt_get_chip_id(dn);
 	index = dt_prop_get_u32(dn, "ibm,npu-index");
 	phb_index = dt_prop_get_u32(dn, "ibm,phb-index");
-	dt_for_each_compatible(dn, np, "ibm,npu-link")
-		links++;
-
+	links = dt_prop_get_u32(dn, "ibm,npu-links");
 	prlog(PR_INFO, "Chip %d Found NPU%d (%d links) at %s\n",
 	      gcid, index, links, path);
 	free(path);