From patchwork Tue Nov 21 19:40:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10068819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7D4860586 for ; Tue, 21 Nov 2017 19:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E0529978 for ; Tue, 21 Nov 2017 19:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B59532997B; Tue, 21 Nov 2017 19:41:08 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EBE02997C for ; Tue, 21 Nov 2017 19:41:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFDF56E5A3; Tue, 21 Nov 2017 19:41:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id D41B389C1F; Tue, 21 Nov 2017 19:41:03 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BC4BC607E2; Tue, 21 Nov 2017 19:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511293263; bh=QD4UYZmUbelG1liRkMQu0H368LKE1qrIfrEDuVrvaKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAMEbqwKrS2q6oSO+W9GZfjuT+/trG47Q2M7DR1bC9ZXsW16QNUaJTXPwy1KyOwn+ MPF2ucMxBpx9Xd9c/KAx8oOhN07Frq3lPIzSATyfxwgyrcloaRO37tGKF9gRRFGO0u 8V2lH/FgnDoTJTTIIK9qNL0cDq9yBqJa7+E2e2jA= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 065FF607E2; Tue, 21 Nov 2017 19:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511293263; bh=QD4UYZmUbelG1liRkMQu0H368LKE1qrIfrEDuVrvaKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAMEbqwKrS2q6oSO+W9GZfjuT+/trG47Q2M7DR1bC9ZXsW16QNUaJTXPwy1KyOwn+ MPF2ucMxBpx9Xd9c/KAx8oOhN07Frq3lPIzSATyfxwgyrcloaRO37tGKF9gRRFGO0u 8V2lH/FgnDoTJTTIIK9qNL0cDq9yBqJa7+E2e2jA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 065FF607E2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH 1/8] drm/msm/adreno: Call dev_pm_opp_put() Date: Tue, 21 Nov 2017 12:40:51 -0700 Message-Id: <1511293258-12415-2-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511293258-12415-1-git-send-email-jcrouse@codeaurora.org> References: <1511293258-12415-1-git-send-email-jcrouse@codeaurora.org> Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We need to call dev_pm_opp_put() to put back the reference for the OPP struct after calling the various dev_pm_opp_get_* functions. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a5xx_power.c | 8 +++++++- drivers/gpu/drm/msm/adreno/adreno_device.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c index e5700bb..4e4d965 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_power.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c @@ -103,10 +103,16 @@ static inline uint32_t _get_mvolts(struct msm_gpu *gpu, uint32_t freq) struct msm_drm_private *priv = dev->dev_private; struct platform_device *pdev = priv->gpu_pdev; struct dev_pm_opp *opp; + u32 ret = 0; opp = dev_pm_opp_find_freq_exact(&pdev->dev, freq, true); - return (!IS_ERR(opp)) ? dev_pm_opp_get_voltage(opp) / 1000 : 0; + if (!IS_ERR(opp)) { + ret = dev_pm_opp_get_voltage(opp) / 1000; + dev_pm_opp_put(opp); + } + + return ret; } /* Setup thermal limit management */ diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index 05022ea..e1eb7e1 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -239,8 +239,10 @@ static int adreno_get_pwrlevels(struct device *dev, /* Find the fastest defined rate */ opp = dev_pm_opp_find_freq_floor(dev, &freq); - if (!IS_ERR(opp)) + if (!IS_ERR(opp)) { config->fast_rate = dev_pm_opp_get_freq(opp); + dev_pm_opp_put(opp); + } if (!config->fast_rate) { DRM_DEV_INFO(dev,