From patchwork Mon Apr 15 16:04:18 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: 162220 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3106508jan; Mon, 15 Apr 2019 09:07:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMkiCC3ix78bTQf/87AiXTMdAqKZq5tozTsH0wqbiHiAHxFqrN2YI8dR9G2Pi4UAgT7SZ7 X-Received: by 2002:a63:c45:: with SMTP id 5mr71650953pgm.385.1555344424082; Mon, 15 Apr 2019 09:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344424; cv=none; d=google.com; s=arc-20160816; b=dvedG7KeWnwQpNzWX9tG08HqISZaIRqMnQeHG1LFRulpB3nt3W7j/CwNSUt/Hu+OfD CtozsW3ODw7i+8pQhK2afeeAuS/tACXHzapvgqzxc+A5IGYB2TLJFnxXMpOBQKUpVWRV emejqQq8FS1S6UipO0jnkPp24eYRweoVqacxE9Iv9OwrJP7rLkF4njgXgAkFdp4XD82e UfLanvKwcXBQUjsX58Ngv/kjSpLTa7UrutAMEDxFsib/R4aTOPhf67EbLh8UYyMLgB2S Z1MmwCwcSqZ6HW+K4hiB4NJib1UEsqm1ZP6xHvjJSwvF3KEIj2Mz7UbkLZP8bqN/srZe HhLA== 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=JWBOasr8D+53EuLJhCrCPJtNqGy1fkR8v29V/b26zwk=; b=swQiMVpXoRgFKdbkHrJlb3E/KIIusfzH7yRJ/XY1YsYhiANgrm3r+o9KfrStvPUXBv z6eyQ7H54UkKY5RlvdfYHdp5HNLcMg0iU8+H1xqy52KI8iWXDNOFe9EtrVJ9Euz6n/Kn 91TJK0k4ei1Rm09xFcr5xlG/ZMpHGMCMkusr5X52WgO8UpFgpb/W2PwwPG4MKWN3UlEs Iwlm4rF9vhjsnLFQARow3QBu00uBcx4yzjRMZfvosZ7AgiqkV0WOzHfXS9wvke2m4ml+ ig+4VGWh/BpyOJCwg0cAEkjj9mc3jjy5q76uOsTAC2fUrdgzk/4hr2zFhM3aUYZAazj3 0jdg== 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 t70si27014464pgd.386.2019.04.15.09.07.03; Mon, 15 Apr 2019 09:07:04 -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 S1728166AbfDOQHC (ORCPT + 30 others); Mon, 15 Apr 2019 12:07:02 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38104 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728137AbfDOQGq (ORCPT ); Mon, 15 Apr 2019 12:06:46 -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 76AFD1A25; Mon, 15 Apr 2019 09:06:46 -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 F11763F68F; Mon, 15 Apr 2019 09:06:44 -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 35/36] [RFC] coresight: add return value for fixup connections Date: Mon, 15 Apr 2019 17:04:18 +0100 Message-Id: <1555344260-12375-36-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 Handle failures in fixing up connections for a newly registered device. This will be useful to handle cases where we fail to expose the links via sysfs for the connections. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) -- 2.7.4 Reviewed-by: Mathieu Poirier diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 010bc86..4d63063 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1025,18 +1025,18 @@ static int coresight_orphan_match(struct device *dev, void *data) return 0; } -static void coresight_fixup_orphan_conns(struct coresight_device *csdev) +static int coresight_fixup_orphan_conns(struct coresight_device *csdev) { /* * No need to check for a return value as orphan connection(s) * are hooked-up with each newly added component. */ - bus_for_each_dev(&coresight_bustype, NULL, + return bus_for_each_dev(&coresight_bustype, NULL, csdev, coresight_orphan_match); } -static void coresight_fixup_device_conns(struct coresight_device *csdev) +static int coresight_fixup_device_conns(struct coresight_device *csdev) { int i; @@ -1056,6 +1056,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) conn->child_dev = NULL; } } + + return 0; } static int coresight_remove_match(struct device *dev, void *data) @@ -1265,10 +1267,15 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) mutex_lock(&coresight_mutex); - coresight_fixup_device_conns(csdev); - coresight_fixup_orphan_conns(csdev); + ret = coresight_fixup_device_conns(csdev); + if (!ret) + ret = coresight_fixup_orphan_conns(csdev); mutex_unlock(&coresight_mutex); + if (ret) { + coresight_unregister(csdev); + return ERR_PTR(ret); + } return csdev;