From patchwork Mon Apr 15 16:03:45 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: 162239 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3109138jan; Mon, 15 Apr 2019 09:09:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0l18KBGtuyRLr3mqtnncSP1GHCTTjKgumR+Ik51cC3PfPPhUFC906fwjNCaomfr1KHZtS X-Received: by 2002:a63:87c1:: with SMTP id i184mr71721089pge.265.1555344550826; Mon, 15 Apr 2019 09:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344550; cv=none; d=google.com; s=arc-20160816; b=BA+nkVeskk5R4oswwaKy9lOCwwvLkkixXEwGN5DDMpotX+YcQ21xfLKXb6c6ZY0a6G S8fKOi3O8MPcbLKMTWqi1cJ30zv7W4x5l8B5j/ItkgkTzCY17fBqKR+utcd4/6B5iL1A 0VZ56Ic7rh835LqZWud4hxQM8ay6FBjtwQQh07hm6fSxL1YIIyqfUkCsCPhBxcOe2fZV Cftci51a+Ea4ljfuu/1/f0s7LyVkQGn6McvP/LsII9mE3BKgsUn8lSVWcVMHkpfPAVd4 /G7S/XTBCQUyqShFhr4v1LqPDwiA5BpVYvZTNx05dJpy28JII6MwP/E95IaoIbd8Ao1m tC1w== 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=hsOAMpyyEfEWOdOlRzDMt8RoU2py6ixkH/Xfb1+Peuw=; b=KGpW6oFZXQv6j55GZF7r7CYn/narDmmo+WiLeIFIktXz6rRmisPqXRilZgR0vwsrUt 2m6+m6Ahs5cK1nnrUAKTnrUI9pLjxAZD59mcpcmqdSA0BnNdjK8hfK0rWoowVU3v4dtM 6MNHslpa84plKDV9qr7gR33+C7YLhUDhLJlb6dbyB5/vN26GzzXNQDABMeq6kWKfdp2c dC/Re1cL7+mUz/R8EsFb3IOT9x2ZztQQG1flqgxEan8Rl9se3nTW/J6eRBb4Tv232hy3 YWQAShV1OWoA22AdreQxABEofqgk+z6agdxsCHykqegLShVfLaf3X6/FEZtzrL2G9OeG E+cw== 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 v12si38928910pga.148.2019.04.15.09.09.10; Mon, 15 Apr 2019 09:09:10 -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 S1728115AbfDOQJJ (ORCPT + 30 others); Mon, 15 Apr 2019 12:09:09 -0400 Received: from foss.arm.com ([217.140.101.70]:37656 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727696AbfDOQFs (ORCPT ); Mon, 15 Apr 2019 12:05:48 -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 2380280D; Mon, 15 Apr 2019 09:05:48 -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 9DE6C3F68F; Mon, 15 Apr 2019 09:05:46 -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 02/36] coresight: etb10: Cleanup power management Date: Mon, 15 Apr 2019 17:03:45 +0100 Message-Id: <1555344260-12375-3-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 We drop the power before we complete the probe successfully. We are supposed to drop it only when we are successful. Also, probing the etb_buffer_length happens with the power turned up. So we don't need to do that again in the helper. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etb10.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 105782e..13c0a60 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -93,17 +93,9 @@ struct etb_drvdata { static int etb_set_buffer(struct coresight_device *csdev, struct perf_output_handle *handle); -static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata) +static inline unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata) { - u32 depth = 0; - - pm_runtime_get_sync(drvdata->dev); - - /* RO registers don't need locking */ - depth = readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG); - - pm_runtime_put(drvdata->dev); - return depth; + return readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG); } static void __etb_enable_hw(struct etb_drvdata *drvdata) @@ -720,7 +712,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&drvdata->spinlock); drvdata->buffer_depth = etb_get_buffer_depth(drvdata); - pm_runtime_put(&adev->dev); if (drvdata->buffer_depth & 0x80000000) return -EINVAL; @@ -747,6 +738,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) if (ret) goto err_misc_register; + pm_runtime_put(&adev->dev); return 0; err_misc_register: