From patchwork Thu Apr 25 19:52:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 162886 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2364310jan; Thu, 25 Apr 2019 12:55:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZD0ocwcFMcQ0ZciYEtLmbGTCyQmy8TK6UMNEesnxKyD8oT6teMfkLMPCr/CqKb8J7UMIi X-Received: by 2002:a17:902:988e:: with SMTP id s14mr41125186plp.167.1556222146818; Thu, 25 Apr 2019 12:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556222146; cv=none; d=google.com; s=arc-20160816; b=fmRmlqNAWKCj02SM0Bs7scyA/J044SSgjX4I+e7BF+/VL4JmqersJQnxs3KnJVeeh5 OFA7ekrnVI7syAigdvg8CPfdYgZkQFoJYKSJkfaheSahMvZQaRIRwoIQUsGHYqS71KEb g+vrYZix0beMbpWxhiOh/GVEFb4AxUB2PSYMoz233I854mK108sPDFpsV0JfBxDT00Yq emwr59GW1meLbIP2gLr9wNrarTdBFxDGZRz+VHNqRFXN8Qy27CPX5SnsXTKhI4qiFdUc dR2m+z2EwxnFax2qAMaFbrIHyV4WRUAb0+KCHsunO5Y+llgAmleZK88FV/d2yTrWtJRF hkHA== 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:dkim-signature; bh=S4WlHnFG5egtduagk/Bt1xYutlfv3Ip/YBn9x1XM4EU=; b=o6PoUh8HC2Fpalop1ViDfRn4JiYsIFsB2fj3XwKXPC2LHXEAs5xoq0xr2xKXhiPE5i ku9cipnvA5sWtUSuwopJ2WFYokK3oZII1JEfrG8mNH0ZW/AWq25f+1ESorS4xaccx9rb lYpRR5RxN+rlDa7CEfowYUd1OpSs9Vm9ChSTxROjOEIH6zumd8QNpBaO0+Q/pKj9nVo9 g5BQKrWih41w3aDn/S4n2f7w3OESg2GMR2FP56ZEi6yORt3V0GxqbbFYfJPvDZp38uGe dFYkhJtXe0ecm1qBAAu7Wf7nEzQtLsq2sRPrxxrxWqi1UgML9Tdn5GCmgcZIjbcfmUN0 CLBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wp3ppGlG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m184si4673024pfb.166.2019.04.25.12.55.46; Thu, 25 Apr 2019 12:55:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Wp3ppGlG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387981AbfDYTzp (ORCPT + 30 others); Thu, 25 Apr 2019 15:55:45 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41304 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387679AbfDYTxY (ORCPT ); Thu, 25 Apr 2019 15:53:24 -0400 Received: by mail-pf1-f196.google.com with SMTP id 188so430000pfd.8 for ; Thu, 25 Apr 2019 12:53:24 -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=S4WlHnFG5egtduagk/Bt1xYutlfv3Ip/YBn9x1XM4EU=; b=Wp3ppGlGiFVO1Vn9eXRcx8g5nX2CdbRPP1OODDgBj1aA9gkpvgu5BF7wRkz0LK/HgM 1/YBfJTtGSU6YiZpXXMCiqNdn78hPT79tA70DCpP3P3L/xsaySxL688Sn7n0IQsm36f+ ghAbYg329ozozMR1jhqJVasLZgVipC29M97EvTRcPXA9juKwq01mj9yPgyHGa33O+HWS hk9niM8eb+xtSvwC9rBIKMOn8G6M2o8sjePEfElDpC/f0K+Lk1Gdkvy4CHvEoWQ2jjQ+ 9y/rS2olswu8UoKHXeIqfuqx57AsvKZwV0OJXdGbeYo//7bYz6RrSaLyK6qi8ViZGxgc jM5Q== 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=S4WlHnFG5egtduagk/Bt1xYutlfv3Ip/YBn9x1XM4EU=; b=sYC/4Qi2a/0U54wHhS/eQWPmXkfLedSyYZ+Wedapzk/pYUB1IRKOySVFwsG09TWbt+ divWQaXDKXXkVm9kxnkO3JWscfNGnYlcB0lX2PWDOdwMwSd72gr9vRAELMkaTwUDWOz4 SeoqeBFOfj8ZS4vPHpgPnV4XBqjbm8ekuJ4w//Gmzm3XUEh2MkQF06JrPkqi8tEJbohu 7JVae3oF896LEH/HdkEzdo87ZemzbVvyBjri2WPaTI+ABsp5FFMfdG1Ltw+H93fF/QYN DVbEN5WQi/NzaxrBdvYclzDbLGtZaxZ6amOiNoUFnjyGSz8xOQqUGuqT4yzJofxkDfVF 6XWg== X-Gm-Message-State: APjAAAXL3ouhMsPIZ22aBRhO4mVwljbVrant69FHkIwUGd0s1nQzWPmo TH4BDuYu6P1OSCKVzNjQd5Utsw6eLbk= X-Received: by 2002:aa7:8208:: with SMTP id k8mr8119903pfi.69.1556222004179; Thu, 25 Apr 2019 12:53:24 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t64sm47261961pfa.86.2019.04.25.12.53.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 12:53:23 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/32] coresight: etb10: Cleanup power management Date: Thu, 25 Apr 2019 13:52:47 -0600 Message-Id: <20190425195310.31562-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190425195310.31562-1-mathieu.poirier@linaro.org> References: <20190425195310.31562-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose 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 Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 105782ea64c7..13c0a601d3be 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: