From patchwork Mon Aug 24 08:28:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E778C433E3 for ; Mon, 24 Aug 2020 08:34:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EAA0206F0 for ; Mon, 24 Aug 2020 08:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598258042; bh=GwWkOnTNSfoqWpRpo6c0fbK/dHqVyF3qlqTjGMu08O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mTQkAloOYVI/ZBQh8C5cCHBC2aSTpocxXPtmllNlnzDRfmeR+uMeFrkO7oaraUZUX 7Z23u2dYmKl4k2VC8uWQa7CSnusCwtTFbmaP0q5VML1xNTcTro66hhwA9ApFx5PpMk YkTS17bylBgsT6MUAsR5X9Yy38KkAi/IXeOMYDhk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727821AbgHXId6 (ORCPT ); Mon, 24 Aug 2020 04:33:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:41826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbgHXIdy (ORCPT ); Mon, 24 Aug 2020 04:33:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6435D206F0; Mon, 24 Aug 2020 08:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598258033; bh=GwWkOnTNSfoqWpRpo6c0fbK/dHqVyF3qlqTjGMu08O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WsexVZbdKKJH5qBpJvLnhFI0/UnOMo1lpcDO4YwdzF5QNSooIF/jheJrHXVQPBd+Y +0HprYTs1aZmnDZEk3YkpqbySniSIJsY2t9rXkNTICmqw0JIge431MUZSxy/clMRcH +8KFau59otLyfDDq0u6Mlu7RnsE68tLz8G6xPkuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sajida Bhanu , Sibi Sankar , Matthias Kaehlcke , Stephen Boyd , Rajendra Nayak , Viresh Kumar Subject: [PATCH 5.8 022/148] opp: Enable resources again if they were disabled earlier Date: Mon, 24 Aug 2020 10:28:40 +0200 Message-Id: <20200824082415.034408835@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082413.900489417@linuxfoundation.org> References: <20200824082413.900489417@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rajendra Nayak commit a4501bac0e553bed117b7e1b166d49731caf7260 upstream. dev_pm_opp_set_rate() can now be called with freq = 0 in order to either drop performance or bandwidth votes or to disable regulators on platforms which support them. In such cases, a subsequent call to dev_pm_opp_set_rate() with the same frequency ends up returning early because 'old_freq == freq' Instead make it fall through and put back the dropped performance and bandwidth votes and/or enable back the regulators. Cc: v5.3+ # v5.3+ Fixes: cd7ea582866f ("opp: Make dev_pm_opp_set_rate() handle freq = 0 to drop performance votes") Reported-by: Sajida Bhanu Reviewed-by: Sibi Sankar Reported-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Reviewed-by: Stephen Boyd Signed-off-by: Rajendra Nayak [ Viresh: Don't skip clk_set_rate() and massaged changelog ] Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/opp/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -901,10 +901,13 @@ int dev_pm_opp_set_rate(struct device *d /* Return early if nothing to do */ if (old_freq == freq) { - dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n", - __func__, freq); - ret = 0; - goto put_opp_table; + if (!opp_table->required_opp_tables && !opp_table->regulators && + !opp_table->paths) { + dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n", + __func__, freq); + ret = 0; + goto put_opp_table; + } } /*