From patchwork Thu Sep 20 19:17:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147126 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2375932ljw; Thu, 20 Sep 2018 12:18:32 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbl1gMEFYCpQCM4rb+Cse1qQafajX8LtRPUp/R4ibfCQK2aELeiI58Z8RwMzOQYmRCpoiiE X-Received: by 2002:a63:4909:: with SMTP id w9-v6mr1164274pga.123.1537471112185; Thu, 20 Sep 2018 12:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471112; cv=none; d=google.com; s=arc-20160816; b=hNYA9szf6tR09tEYO/SDJVLyqA6+rSTg0uCcp4Ij2tCFH4/3+/6vIR2SUZlKUNVjsi hnKe7eGYYCW5lmC50qRcjc2tX2D1guOLTRVwzbefdExWO/o9qUrviBezmjhN7BcDo0Dm lVLR16pCswbPMMal+BVdDjH3KDBOl+VFeU4zNbgNX1FsLScSa2BJKQx/7S66dOKhk3sm ocMPipRJwx4rzHbz6vDhgdjPo9nMny8A2f9iZ8N8QmGkCVc6zgzel/PwWh11WueKljSA ZsGRzbuI4ZlW7nmsipzq+CPIwBwEuWbRE0GgxDkfcgL1gLBw6VcO7lGnez1L0DgFL7yp LYKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=1I05pDEl9YDQOPdvRPriVg9w4n3vH5AzvtyzOmauupU=; b=r2xEWqMuzowWm224etEqUJUe2MYBR/gNiiMDedAGU3LBW67+rTpwKxpYzTEf6zStQ7 RxejenCRL5e4WmCNTN6qDDqDn149bgl0QEnclgsGGalUiTb8CSCY0SRx0juhP77GM/Dj gTS2g/3bvQVPuj6KBtbBouzmi3zXWPKEW0N5WUXTaNlO9jVQHuoK/vtfCTIGU/yJ6Wb4 R4/yYOCO6KKFJr+4kZ9n6uOwCqqJtRm3THC3s6CcGkEr1sE6Ry1eH9VjSv6G49t86IXU IWbYJSXUVsrF2tiEhyjGs/nKtoTIsJ+MfqVjjzEm0vwtMHTFrVU5F+79fag/eGE+cWgK n04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AFXnTFun; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13-v6si26599001pfc.194.2018.09.20.12.18.31; Thu, 20 Sep 2018 12:18:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AFXnTFun; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388679AbeIUBD2 (ORCPT + 32 others); Thu, 20 Sep 2018 21:03:28 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38249 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388652AbeIUBD1 (ORCPT ); Thu, 20 Sep 2018 21:03:27 -0400 Received: by mail-pl1-f194.google.com with SMTP id u11-v6so4799553plq.5 for ; Thu, 20 Sep 2018 12:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1I05pDEl9YDQOPdvRPriVg9w4n3vH5AzvtyzOmauupU=; b=AFXnTFunALZucfagVHzD8O6hubQF08TjXfiUNUNeDvJ1F6KOosTEBz4ucMLAc5G0Oe 7yFl5oEDsiDQipnMjDIu3CiqEpT0jzgGywiE4cfDyM792fcfRykgBYgrcMQU1vOgKiJJ 6S9vUVQD4XUKIAst+Gg5yyPlbZJKgXIPj+vUQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1I05pDEl9YDQOPdvRPriVg9w4n3vH5AzvtyzOmauupU=; b=Y2pjoOs17qiabP+GbvX8W9cngQ7wDTmv4Fnu+4lb8t1Yp/8OtGIAef8TM0IBnooP0v /Pf271rlEDMcndTXvwW5zizTUKQ6VPqSST2/6n4221Q4kkIyO93pBL4RM8ODb4inAKxz 32bFPsfpUFQ0sY0xUFqdL/p26V9EfN18pCL/7JYF8Dptmk2yNPBYDBH0VPzPJo6Q8IrJ Zkwuc3dkvRXbnpIgfHreoreRAHRlcoyuo9qJK2E0v+ld2Bov+lkNlnzc/Y8SVS7cWNBO /yjASJ3Xiqpsv12BbA38xB6VnKs7/Lvth3m8wevFbf+QhbkJfTyQpy8a7gtY8qEBYT53 tfHg== X-Gm-Message-State: APzg51C/8Auz0yMSz+gbwbZr3YN5T0QkY9UbAkGn0uIc9OcvuxxF+jeQ fvCKpF90t54dkFX1qveTVOyntw== X-Received: by 2002:a17:902:d881:: with SMTP id b1-v6mr41058327plz.191.1537471108949; Thu, 20 Sep 2018 12:18:28 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id k13-v6sm4424443pgf.37.2018.09.20.12.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:18:27 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 05/44] coresight: Fix remote endpoint parsing Date: Thu, 20 Sep 2018 13:17:40 -0600 Message-Id: <1537471099-19781-6-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> References: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose When parsing the remote endpoint of an output port, we do : rport = of_graph_get_remote_port(ep); rparent = of_graph_get_remote_port_parent(ep); and then parse the "remote_port" as if it was the remote endpoint, which is wrong. The code worked fine because we used endpoint number as the port number. Let us fix it and optimise a bit as: remote_ep = of_graph_get_remote_endpoint(ep); if (remote_ep) remote_parent = of_graph_get_port_parent(remote_ep); and then, parse the remote_ep for the port/endpoint details. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/of_coresight.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 4b279f8fea0c..2ecdd1432b5c 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -134,7 +134,7 @@ static int of_coresight_parse_endpoint(struct device *dev, int ret = 0; struct of_endpoint endpoint, rendpoint; struct device_node *rparent = NULL; - struct device_node *rport = NULL; + struct device_node *rep = NULL; struct device *rdev = NULL; do { @@ -142,16 +142,16 @@ static int of_coresight_parse_endpoint(struct device *dev, if (of_graph_parse_endpoint(ep, &endpoint)) break; /* - * Get a handle on the remote port and parent - * attached to it. + * Get a handle on the remote endpoint and the device it is + * attached to. */ - rparent = of_graph_get_remote_port_parent(ep); - if (!rparent) + rep = of_graph_get_remote_endpoint(ep); + if (!rep) break; - rport = of_graph_get_remote_port(ep); - if (!rport) + rparent = of_graph_get_port_parent(rep); + if (!rparent) break; - if (of_graph_parse_endpoint(rport, &rendpoint)) + if (of_graph_parse_endpoint(rep, &rendpoint)) break; /* If the remote device is not available, defer probing */ @@ -165,15 +165,15 @@ static int of_coresight_parse_endpoint(struct device *dev, pdata->child_names[i] = devm_kstrdup(dev, dev_name(rdev), GFP_KERNEL); - pdata->child_ports[i] = rendpoint.id; + pdata->child_ports[i] = rendpoint.port; /* Connection record updated */ ret = 1; } while (0); if (rparent) of_node_put(rparent); - if (rport) - of_node_put(rport); + if (rep) + of_node_put(rep); if (rdev) put_device(rdev);