From 9363dca0f4ad0a3f88271e4d6ac33d3de9948d2f Mon Sep 17 00:00:00 2001 From: Gavin Shan Date: Wed, 6 Jul 2016 13:20:01 +1000 Subject: hw/npu: Get number of links from NPU node property 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 Signed-off-by: Stewart Smith --- hw/npu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'hw') diff --git a/hw/npu.c b/hw/npu.c index aa2194a..5301bc1 100644 --- a/hw/npu.c +++ b/hw/npu.c @@ -1277,7 +1277,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 */ @@ -1285,9 +1285,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); -- cgit v1.1