From patchwork Wed Sep 9 11:28:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 53314 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id E5B7122B05 for ; Wed, 9 Sep 2015 11:28:35 +0000 (UTC) Received: by wisv5 with SMTP id v5sf5734174wis.0 for ; Wed, 09 Sep 2015 04:28:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=AT48DK5EWY6Id7rNfCapZPvAOyz7Yy3OERg9vxMvXrQ=; b=U7joj4DLoPy0TSK5a0VI4HPaRmr2GsxdC28Dll0QpQys5jEeBu6DLFKfVwghehXMbN IwvQepUk3J9oUe9yZE/KmuJRy9zKlR8TJm/k4NvjixzAsWZrYPSJFRSDYlNw4Ae2L3ly bUfMnkGKDVku67zr5nk4xJXstDfgXsFJn/v7hvzzwzKN8XVEe1CTwYag8CMn0OPiZKjE qq6bEj/xmFGzaoU1JnXe6r7H7Hfn0nqn0gSXqV4xTsFp1DJN3wHhs3ExAxBJXYcr/t1Q I+pRixEkDyqqPLn5hOY/cIWNcTtUqnEHHJhozkgddfOvBhPMYn1t0ci7Uww0ld5VQUA3 +GcQ== X-Gm-Message-State: ALoCoQmom3pODhEcT06XtY+rP33dkxdrHOEzN9ym7AKZCxF+UoqCvmB8KhezaZhkpuHAVz8vGKYM X-Received: by 10.180.87.199 with SMTP id ba7mr8073536wib.5.1441798115167; Wed, 09 Sep 2015 04:28:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.135 with SMTP id q7ls33952laj.77.gmail; Wed, 09 Sep 2015 04:28:35 -0700 (PDT) X-Received: by 10.152.18.133 with SMTP id w5mr18163457lad.72.1441798114998; Wed, 09 Sep 2015 04:28:34 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ua1si6407154lbb.29.2015.09.09.04.28.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Sep 2015 04:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lanb10 with SMTP id b10so4549162lan.3 for ; Wed, 09 Sep 2015 04:28:34 -0700 (PDT) X-Received: by 10.152.178.165 with SMTP id cz5mr28123771lac.29.1441798114861; Wed, 09 Sep 2015 04:28:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp270153lbq; Wed, 9 Sep 2015 04:28:33 -0700 (PDT) X-Received: by 10.66.246.228 with SMTP id xz4mr61340789pac.46.1441798113640; Wed, 09 Sep 2015 04:28:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ju7si10912305pbc.253.2015.09.09.04.28.32; Wed, 09 Sep 2015 04:28:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753308AbbIIL2b (ORCPT + 12 others); Wed, 9 Sep 2015 07:28:31 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35048 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbbIIL2a (ORCPT ); Wed, 9 Sep 2015 07:28:30 -0400 Received: by pacfv12 with SMTP id fv12so8064598pac.2 for ; Wed, 09 Sep 2015 04:28:30 -0700 (PDT) X-Received: by 10.68.218.136 with SMTP id pg8mr70117796pbc.169.1441798109900; Wed, 09 Sep 2015 04:28:29 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id f5sm6730303pas.23.2015.09.09.04.28.28 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 09 Sep 2015 04:28:29 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Pavel Machek Subject: [PATCH] PM / OPP: Return suspend_opp only if it is enabled Date: Wed, 9 Sep 2015 16:58:22 +0530 Message-Id: <31e1c19352d71233ef4aebda265ef341e1e4dcb6.1441798015.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There is no point returning suspend_opp, if it is disabled by the core. As we can't use it at all. Fix it. Cc: Bartlomiej Zolnierkiewicz Fixes: 4eafbd15b6c8 ("PM / OPP: add dev_pm_opp_get_suspend_opp() helper") Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 3d948eabf3a7..28cd75c535b0 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency); * @dev: device for which we do this operation * * Return: This function returns pointer to the suspend opp if it is - * defined, otherwise it returns NULL. + * defined and available, otherwise it returns NULL. * * Locking: This function must be called under rcu_read_lock(). opp is a rcu * protected pointer. The reason for the same is that the opp pointer which is @@ -356,17 +356,15 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency); struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev) { struct device_opp *dev_opp; - struct dev_pm_opp *opp; opp_rcu_lockdep_assert(); dev_opp = _find_device_opp(dev); - if (IS_ERR(dev_opp)) - opp = NULL; - else - opp = dev_opp->suspend_opp; + if (IS_ERR(dev_opp) || !dev_opp->suspend_opp || + !dev_opp->suspend_opp->available) + return NULL; - return opp; + return dev_opp->suspend_opp; } EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp);