From patchwork Wed Jun 19 19:52:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F90A186E for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F6D5286A1 for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73AC4286BF; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 22FDB286A1 for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7/DW5kj+WaQ+dk61cbQkcnaKyrDHy3ffTsBctYDZX4I=; b=i4uMGL4Lc51lOmwvExxWWg0gZ1 3tvfzJ9OQHCEFWeoGFh3hMXLji4qYGisvcebctzNxXOjI+RQxrXPAOdkkoS8566Izf+nxi/Vdk3DK dReH0R8AMPaM4GGhguuCWChZ6UFJLlofseu40xwojGFiPdfy/pXukRr2Z0wgRf/dMrXTAdOkcC3to 69bVzQ4vtQzme+GyZ+MrKm+qUgGH161Kj+f5yKi2ZAd1MqyFvHbddqfETY6IEIniEChaRTiTyzmtb sn8ZBHhUq1nB9MEmFpnYWWVTM3gPs3I2YmoNuPypQj44TSB6062FO4Fpmjk5m6qVTtm3yvdpXKFXx rvTpYyLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdghM-0001ky-3Z; Wed, 19 Jun 2019 19:56:48 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge8-0006RX-Uj for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:30 +0000 Received: by mail-pg1-x541.google.com with SMTP id 145so243065pgh.4 for ; Wed, 19 Jun 2019 12:53:28 -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=wam6AHm/miO8TP1PGtbm8g85UgtcibQj68H7pbJwhxc=; b=jv8C5sBgLZvfD3CWqky7lPJw71eylFz2iEv0QQ+qjikurZx9t20ZW/8qjspp/7YuNb NC1QxdLXPxVOfWctUuNLwY3i267Bul4TQKFY+apKPgC1m2KTmjsOpiRNsAH3Ee05+14b U0WIe3H+XXhi8l9gcFRMtJgDVPGHFy0bQ3Hbg4P6Is1rj6i9wjGwxVlseNrBtwW4YPl+ p0gv5OELvFsJk/oAC1gLfSRW3ZJC6IxQA0Pzmob77WVjsMPT24RQOp2qATWr5w4r6AKB oWC7Nfx0tKjMBpbPUXZbXXWZB9ZRjTb4ayXKifB6dKqKpKy5H4HeAR5HrV8nXt0eyFpR TKSQ== 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=wam6AHm/miO8TP1PGtbm8g85UgtcibQj68H7pbJwhxc=; b=mpM6BE4sYawsPEH1FRrq92k5fwMIy2lM/W/YSoxYyXKKkTWFA3ZLJnJrWpMHNBDu4/ fo/VsSO0DPWGXqLqsi3DLSJ37m1GjcmuvnXrLH3scH8t2m2iNJmdKVsOB1yC0VfqO4EB 68tiL8XeIw1m4O9HGulFGNEpZuP4yFmXt0Ad1tgGEtyfI5S+wSlqKO1Ld27QVSYKePag 9lgSqIVgIUqvOY6qvHFtCN+IoluCDXlkQURalMwZrFx9hXHGrn9vVpQTRqBBaGSkYxVx a1R5bmg+BPbUFUATQnmjsf2zUsPVLu7e0BON0SBiotFdcyg+aFgvQQUALVqn3MJ/7dhi eZog== X-Gm-Message-State: APjAAAVjj3nBk8n7RApIqeZ6JiJ/nhHkKelS/lbmV3lswr13+a7n3CBQ o81FUL/V5/XPwae7MamvVxgcaw== X-Google-Smtp-Source: APXvYqzXMuOSRJVlHqz9vo/V0aJLBwsZZfnBia1B9XQmdnm4nrQscjsdhx9XQVMOfMlWkBRP9JRfgw== X-Received: by 2002:a63:fb4b:: with SMTP id w11mr9206012pgj.415.1560974008167; Wed, 19 Jun 2019 12:53:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:27 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/28] coresight: Cleanup coresight_remove_conns Date: Wed, 19 Jun 2019 13:52:58 -0600 Message-Id: <20190619195318.19254-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125329_041242_9340154B X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose 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. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 04b5d3c2bb3a..068bd2fc0985 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1096,10 +1096,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); } /**