Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp680757ybh; Wed, 22 Jul 2020 10:23:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD6pmzhmwULAcN3YdzFCCDw7dEhyJ7SD7dE5OdsJJ5cqTLHBQxILsyYUddQJHuYswaSKBy X-Received: by 2002:aa7:d8cf:: with SMTP id k15mr501998eds.250.1595438608572; Wed, 22 Jul 2020 10:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595438608; cv=none; d=google.com; s=arc-20160816; b=ch+/pb90RbNjUrETEdPNYZO7TKdN6WpWxfU27TY3xwJ/zVA2vDmrg0ZMaDB0G2NUb6 B7caMYtkWQiWLvsKWwM1EmSs2MOJ7uDpsQpjaamQcJKhuli32Prf2fAPgAXm3QvysGE4 q7P3LLulHOnXEixDz2R5R7nra9ALd7cTs8YMV65sIaaR0tPaR8MiKfx+kxrZibjpQe+z 9FWU828hOb4jZT9jLDJ7JCSJUWmITKgNTgqJKZtU19Y6si6l4kSlMx5GkJkxZwdZoPek XWkWr3PHxB1o5JX6SBE4wwGMp7p+ySuQWoO1ZLwiR5rdtGv6pcB5XJWIpRms9Hq7w1yb eNzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lBXkZ/GAHWkTmqGCZSNqFFUmxulrw5AE2p3BHSAhbeQ=; b=0GEgGg9kj+Rk8ogFxSVkA4VPpGvYQLQDEIn8Tx/vSejKUjZVX6AGgmrreppz9c8xCT e0+LCvNGJo6W3lbL8GbP3Ky7RKm+qmp+ze82HR1Tk0e3+DLPOC0K9pYOyAeELs9CV/QK O0Vix4/agueN6bMscYLthslKBLBR3bvTlm4IflSVshluce8Lv1U+WfxIH+XCH6Ss2QbF fLKBYz4I7Nc02d33ebynnMpgOSmCq7QP7LhqtC3prMpPSdxyoGpNJOtN0k7uSbLjd+cB HRkcGqF6syrJtouYqiqMV8attsV9VUfoYteFhu/5CnVEk5wWPgL8VzffaMDw0b0sGyHu 97Cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si413336eji.349.2020.07.22.10.23.06; Wed, 22 Jul 2020 10:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731113AbgGVRU5 (ORCPT + 99 others); Wed, 22 Jul 2020 13:20:57 -0400 Received: from foss.arm.com ([217.140.110.172]:59944 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730800AbgGVRU5 (ORCPT ); Wed, 22 Jul 2020 13:20:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF08AD6E; Wed, 22 Jul 2020 10:20:56 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EA5C63F66F; Wed, 22 Jul 2020 10:20:55 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mike.leach@linaro.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org, Suzuki K Poulose Subject: [RFC PATCH 01/14] coresight: etm4x: Skip save/restore before device registration Date: Wed, 22 Jul 2020 18:20:27 +0100 Message-Id: <20200722172040.1299289-2-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200722172040.1299289-1-suzuki.poulose@arm.com> References: <20200722172040.1299289-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Skip cpu save/restore before the coresight device is registered. Cc: Mathieu Poirier Cc: Mike Leach Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm4x.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 6d7d2169bfb2..cb83fb77ded6 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1135,7 +1135,13 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) { int i, ret = 0; struct etmv4_save_state *state; - struct device *etm_dev = &drvdata->csdev->dev; + struct coresight_device *csdev = drvdata->csdev; + struct device *etm_dev; + + if (WARN_ON(!csdev)) + return -ENODEV; + + etm_dev = &csdev->dev; /* * As recommended by 3.4.1 ("The procedure when powering down the PE") @@ -1261,6 +1267,10 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) { int i; struct etmv4_save_state *state = drvdata->save_state; + struct coresight_device *csdev = drvdata->csdev; + + if (WARN_ON(!csdev)) + return; CS_UNLOCK(drvdata->base); @@ -1368,6 +1378,10 @@ static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, drvdata = etmdrvdata[cpu]; + /* If we have not registered the device there is nothing to do */ + if (!drvdata->csdev) + return NOTIFY_OK; + if (!drvdata->save_state) return NOTIFY_OK; -- 2.24.1