From patchwork Mon Apr 15 16:04:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 162227 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3107469jan; Mon, 15 Apr 2019 09:07:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqytfX0nj7/LT/PB/tiivPtELPcqGX/4UbQf77pbPwDGcURHUj5cBzqNTtsjoBtw5w9wLQyX X-Received: by 2002:aa7:85cc:: with SMTP id z12mr76061705pfn.142.1555344470923; Mon, 15 Apr 2019 09:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344470; cv=none; d=google.com; s=arc-20160816; b=MC5RGRyvlfNkbvlTVGx8IU3r8dS9xMiIjKAlXkA98jqW4oPXZ4Wey6MHokXBPhMffn 877tDq0AwRlw3cjhimTQbQi0q/wDYywWRt9TKuj/+oWRVv6ertq/tpJKnbk/x77v8hPi NaE1/Ml7PvRj9ksDHXqwh4AiZT1RJeuVA3pNwBj9s6/vHreU6gogOb9SDkpjKvOirPPy BOCRJU+SGTf3m8w+06vsIPxclN2nJHzgVzMHm958r9cYWil49JNYfUBR1jkkPYh66qaV vzozkTpGu5/AnT64EJHldoreE98QbmXT+DPJXSXe6LhlpJ8GDlIODXYTYdjqQgvMsyaf Vymw== 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; bh=A7QNmln8poZlbVc+qbMrbSEzPfmS2GxM0Wh6cJiPCIE=; b=XvtQsOYRAte9ll9XjU1849+xTxv2E7CPt6DxmhBeBEWIfKtCxlKSzERU1PilCD0JlR U1sngZxcb7nnKNs7hti5RlH3LN+jn+jGTwdRf4+aMT8cupv5OvDCfjH4VtOp7G0HvhUy IkugLoTObTBIFpkUad+g29G673kFED1PtZeKhfJVhCXIb8uK6b33zmcsejEZbEnLvksj hnCJEwRud2ZR+8ksy7tXvjs+z4pvDDV7JdQr1qqccC9B8F1LS621P06BZyYUU4fjko8e xo2QS+xypqI8rvpdM2VmVu27t76Kvw2JFWEQ7QzT4Yxg+ZaKKBpKHdsplwcXcY4aCUrq dCLw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si47185811pgr.133.2019.04.15.09.07.50; Mon, 15 Apr 2019 09:07:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728047AbfDOQHt (ORCPT + 30 others); Mon, 15 Apr 2019 12:07:49 -0400 Received: from foss.arm.com ([217.140.101.70]:37944 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbfDOQGZ (ORCPT ); Mon, 15 Apr 2019 12:06:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 34B6F1A25; Mon, 15 Apr 2019 09:06:25 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AE3DC3F68F; Mon, 15 Apr 2019 09:06:23 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, rjw@rjwysocki.net, robert.walker@arm.com, Suzuki K Poulose Subject: [PATCH v2 23/36] coresight: Cleanup coresight_remove_conns Date: Mon, 15 Apr 2019 17:04:06 +0100 Message-Id: <1555344260-12375-24-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> References: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a device is unregistered, we remove all connection references to it, by searching the connection records of all devices in the coresight bus, via coresight_remove_conns. We could avoid searching if this device doesn't have an input port (e.g, a source). Also document the purpose of the function. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 91c63cd..530ad69 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1094,10 +1094,21 @@ static int coresight_remove_match(struct device *dev, void *data) return 0; } +/* + * coresight_remove_conns - Remove references to this given devices + * from the connections of other devices. + */ static void coresight_remove_conns(struct coresight_device *csdev) { - bus_for_each_dev(&coresight_bustype, NULL, - csdev, coresight_remove_match); + /* + * Another device will point to this device only if there is + * an output port connected to this one. i.e, if the device + * doesn't have at least one input port, there is no point + * in searching all the devices. + */ + if (csdev->nr_inport) + bus_for_each_dev(&coresight_bustype, NULL, + csdev, coresight_remove_match); } /**