From patchwork Thu Jun 20 03:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167284 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1492346ilk; Wed, 19 Jun 2019 20:06:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIcP1CMz3OruTEXQXSViYmkgvbzbgiH+TOzYex/lNSaHABH5IrEP+WNbkqaRIWw5nt2SGp X-Received: by 2002:a62:1652:: with SMTP id 79mr64679118pfw.20.1560999999255; Wed, 19 Jun 2019 20:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560999999; cv=none; d=google.com; s=arc-20160816; b=WCDLhTBIRVyjo1tREo+ShYvN78wVDYuXQVoi+2lnbyFsSXUZGpsQs7NkyA2c5Ub6EP 57cV76Z2MUk2aDz1ZMLSsJx4lrB2TLOkw8PYIl+59CQKMaRVv0qFAsEfJTcJZlt0yNtc JDHaUJCk6OAZidAZsT8yOj0KK2LMm+RQJNgBf6n2H5UHEufib9OXhAEnhJfdA8pPhYYh wg0LUbB3sMShwLCJR52ZIZY9zYm/6FIzS+Jlgpjc/qKnzXhQqWixU3TSijBfmNnsUDPe 3SsSOzAaWYXG1DJKBX6bLb/msI5z0k5QVAG8fXSUSXO8bicYHSlbBCLOuJ1o1bbIztb+ L99Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V98tUwwV6g6TL0oXF4qejJSzRWuC3JVirQic0+jf+LQ=; b=swZ+eV8n2sZYZH6cnLpmpMO4+10wHB1C19KyEaYDE0FR2djDuWsclYm1IKNRhJcsoz Ws5PWzOvAeaYdgYxkRBl5yrgA4D7FvV2omoXqebt8bY9K38pW/tu9hLA/ulqaPKrsqD/ HLNuzyrMvm7kDanmHZFQtSrXdprRLTSL+0O04joH2lSYoAE6MFdxVnb2O3AKbbPYBWR8 GkvU6nXgXA/YIAs7KFYzaxm2npwVZq7dYohMqNxPMQyT4ik0grhs5jFyH+ufiMo6BRRk 4Tsn3kaq8zMM/n+oX1kKZ0lZdwZTQOePnenSWtjQGFwEVfb8qkkY4OriDe/VDZm8zgSk QMtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mlHwhEeS; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 i22si3040101pjx.13.2019.06.19.20.06.39; Wed, 19 Jun 2019 20:06:39 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mlHwhEeS; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1731433AbfFTDGb (ORCPT + 11 others); Wed, 19 Jun 2019 23:06:31 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43179 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731428AbfFTDGa (ORCPT ); Wed, 19 Jun 2019 23:06:30 -0400 Received: by mail-pf1-f194.google.com with SMTP id i189so780560pfg.10 for ; Wed, 19 Jun 2019 20:06:30 -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 :mime-version:content-transfer-encoding; bh=V98tUwwV6g6TL0oXF4qejJSzRWuC3JVirQic0+jf+LQ=; b=mlHwhEeSUqJF17X4t3Ni9g83PNe8Y5jIUjeDUaIW+0wc1+yy+t6cg8koZ2zwd8tSlT V3vDuVK0+Rn83OifBrN6paB0Z4AurjNPXWFMaYP+FfqotIVynyr6uy6p0HEUMOcB9cyq K/4geXzoVLMdjzwsCaiAngcZZ/71nwDJSpVMmWqYFS5Bd+B69GlNrYkn+zjR4WJ+2n9R l3k8DvZTKsdTL6fjpLP8Vvr2XLwVNr8oaL8KwqeAl8miWVfiMD/YclntsbDo7Cu4A3J0 jQ5y+QTSTjL/RI5SCRBfBj6U6+lNxH2l9kOXB2eSw4SCkIYrnQdMH2hQh/y9bomIaTZ6 sQsw== 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:mime-version:content-transfer-encoding; bh=V98tUwwV6g6TL0oXF4qejJSzRWuC3JVirQic0+jf+LQ=; b=e7o5zzMMCH6ZUWRKj9uWpsqsn0IHBr1DcOmFxuzb+fcNh+NbaNvMwcqJt9LdaZm5zb gvghdkIBYid1+lhY0+e5Wdz2D1tem3MB+OWmCku0EQvGAwJ3X57sjb0c4ovTBLeqjMdc CDsH64qCJTo58ECmH5pKEfp0ZACPaHcfqHcfBFzlpo+dpc2WI4X6cxwatam7dVvbKEx/ 2R1IHe4HkJHnIyPreXzhfCNaThcVTi6AIci0n6bDh3L1OCT4Elb/caxckrtRxCRaI+kG OT4jRhI4bYpMosExcmBgHbKpX7iHWRzz5PLRLkdc3SagkhPqPBG3Uj+PjG9hZTgO3InM YI4A== X-Gm-Message-State: APjAAAVq5lPNsdAPz/7Obnrmug6b3RvMdRK8x3IaQRyX3DRubESyk3C9 noA4LK+ndtsnJFUzGV3uWSxw4A== X-Received: by 2002:a17:90a:3210:: with SMTP id k16mr593435pjb.13.1560999989797; Wed, 19 Jun 2019 20:06:29 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id d6sm18066742pgv.4.2019.06.19.20.06.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 20:06:29 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V2 3/5] cpufreq: Use has_target() instead of !setpolicy Date: Thu, 20 Jun 2019 08:35:48 +0530 Message-Id: <56d8e01d8febb81917aded319249145fdc73daec.1560999838.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org For code consistency, use has_target() instead of !setpolicy everywhere, as it is already done at several places. Maybe we should also use "!has_target()" instead of "cpufreq_driver->setpolicy" where we need to check if the driver supports setpolicy, so to use only one expression for this kind of differentiation. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 41ac701e324f..5f5c7a516c74 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -632,7 +632,7 @@ static int cpufreq_parse_policy(char *str_governor, } /** - * cpufreq_parse_governor - parse a governor string only for !setpolicy + * cpufreq_parse_governor - parse a governor string only for has_target() */ static int cpufreq_parse_governor(char *str_governor, struct cpufreq_policy *policy) @@ -1301,7 +1301,7 @@ static int cpufreq_online(unsigned int cpu) policy->max = policy->user_policy.max; } - if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { + if (cpufreq_driver->get && has_target()) { policy->cur = cpufreq_driver->get(policy->cpu); if (!policy->cur) { pr_err("%s: ->get() failed\n", __func__); @@ -2401,7 +2401,7 @@ void cpufreq_update_policy(unsigned int cpu) * BIOS might change freq behind our back * -> ask driver for current freq and notify governors about a change */ - if (cpufreq_driver->get && !cpufreq_driver->setpolicy && + if (cpufreq_driver->get && has_target() && (cpufreq_suspended || WARN_ON(!cpufreq_update_current_freq(policy)))) goto unlock;