From patchwork Thu Jul 30 04:08:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 247261 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2061917ilg; Wed, 29 Jul 2020 21:08:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaCHLWIX8FR9+DdgMzdbHOumKvQxaVo/lhM6KLLsx264Zu0jnRRKPx+JbBSY5ZqCw/0bjB X-Received: by 2002:a17:906:6055:: with SMTP id p21mr777566ejj.173.1596082110438; Wed, 29 Jul 2020 21:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596082110; cv=none; d=google.com; s=arc-20160816; b=S7ezysYHcxHWWGwU6KJmsttj/Uo++VEZsWpZa/EJpdfLfAm4JFJYAlHySYonVz/fWf fYgMtHKn5UbAaetp0EnQS5sv2hC+3DO9aeUgeiIrJmAR1GoSdIyFKtYKtRAynfF4g2y4 gMz13L1g6iUEVJtA4B7VY1VHIxXDJ1Yb7mq1D5NukwZHZe/TTiIbOhAMkpek5ZwUpM3h GKlCxRf0xkzzXAtP83ekXKNVV266gYGodma2PlpSmG6wZ/VJ+5MBQxaNZNjwXfiqy9mF PhvHibLqGPqLlczma2vzUhKQxFiL+kj3S49Ul7Y0rxq5CP7RhfWnaqpDbeIvQ4uaY7PW +9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=cObSe1rN5NFjpPXj/9JM93EiA5rl/UYVtxX55crPVzg=; b=yqs5KawRHHc/SplP3EOuky5UJSsG0qsPR4emWfhHh3n7DiAAh6vXQgpyTT9T5Ai+4t VprHV/9ta0WX6PSYUeUqK7PxpKf686ONcYDBa8NZ+yQSpNr/4Xacl2Jy3pRRZ/ddJtH5 Cz89E8v6RNNYPjnohiZNkxRltoNsy8taqtjR0SpGuCmC9NY9O2dcNXYL5OOXtPAsZaRP AEaqJSbEkzY0otpOhycvN15W655cS6WDHTqra7nfqlVUxFoD7tsEjLrCEVmNMzVRVPmD b1amvg205wmpEUVT6DLqGHtVAjU6N0iIf3iYcxwmISVTWVvc1Hgl+Pb2RpmzauFKyNNC NDaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLS406wh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n6si2465094ejz.524.2020.07.29.21.08.30; Wed, 29 Jul 2020 21:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLS406wh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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 S1727838AbgG3EIY (ORCPT + 10 others); Thu, 30 Jul 2020 00:08:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgG3EIX (ORCPT ); Thu, 30 Jul 2020 00:08:23 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413E0C0619D2 for ; Wed, 29 Jul 2020 21:08:23 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id d4so15798366pgk.4 for ; Wed, 29 Jul 2020 21:08:23 -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; bh=cObSe1rN5NFjpPXj/9JM93EiA5rl/UYVtxX55crPVzg=; b=bLS406wheq5g5T3PrPTw8WNqDZRIUQzHT3z8/79K2Y0UrzGIlJdG26anZfNSL+93Bt pTkRWvpGmqZx89xyUtA0kwVHyOY9/cjv2b/ysqs3LvU9JBuz9IF+SYhFbasuv+LI7reh ttTWzItEQKptfkxzuQKBs/6APDZP7YWfza4myxd/5j/eBjZ0Z0wa3xrg5yTuMUPU+gBI Ixp4NZ+Wi3jyphu8xN1c5QzwbInMmKghNOCpUXVncMK9djm2so+cUA/o4Am+vPr/JBbp V13W7QKi871zX9spTwJLQV6hykbSnsgZV6icqzicCfKXrqT+gm/0DHFgfcbz5hKR923s w44w== 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; bh=cObSe1rN5NFjpPXj/9JM93EiA5rl/UYVtxX55crPVzg=; b=BlsQTQDAu/YfSDPS7LgIBItOzBGmlIqzjo6jYXm7R+zjJV5a+warccEzvXx6WEVi1y 93c1epRN9Xion/2LuIHez5ivp0KcI7pq1en9VAphm++inR046GHsTLqL4+sq3Nh8wiV8 cG9llwcTA43CwI18imUu9FG2qIJql2NYuvtn4d1Qk4TtA+VNZevAAXoJqEcSX+a1/NNs 4YQ0nW0uAAW+dQNGwikf+dSADFhHrZBIzFE+rPSM5/H7Zhz/zGMNHNdbz4FJZ62RXIEo bgSigfKj8ZnVJgDIbJVqId0Xcl8r0QLJCBLlRhbRpRxOnBpOSavI66WzOyRvJJorjhl5 0I7w== X-Gm-Message-State: AOAM533vzOUZGwS1owauZ/Ia69Nt5NWZv+AUhC1/kgneW18FeJleZ+qK XavwA56ZLc9Vz/xP0DiQ7Dso7g== X-Received: by 2002:a63:d806:: with SMTP id b6mr30041004pgh.403.1596082102597; Wed, 29 Jul 2020 21:08:22 -0700 (PDT) Received: from localhost ([106.201.14.19]) by smtp.gmail.com with ESMTPSA id p127sm4059995pfb.17.2020.07.29.21.08.21 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Jul 2020 21:08:21 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Andy Gross , Bjorn Andersson , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , ionela.voinescu@arm.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: cached_resolved_idx can not be negative Date: Thu, 30 Jul 2020 09:38:15 +0530 Message-Id: X-Mailer: git-send-email 2.14.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It is not possible for cached_resolved_idx to be invalid here as the cpufreq core always sets index to a positive value. Change its type to unsigned int and fix qcom usage a bit. Signed-off-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-hw.c | 5 +---- include/linux/cpufreq.h | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) -- 2.14.1 diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 0a04b6f03b9a..8c0842bd6c5a 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -66,13 +66,10 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) { void __iomem *perf_state_reg = policy->driver_data; - int index; + unsigned int index; unsigned long freq; index = policy->cached_resolved_idx; - if (index < 0) - return 0; - writel_relaxed(index, perf_state_reg); freq = policy->freq_table[index].frequency; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index e62b022cb07e..58687a5bf9c8 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -127,7 +127,7 @@ struct cpufreq_policy { /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ unsigned int cached_target_freq; - int cached_resolved_idx; + unsigned int cached_resolved_idx; /* Synchronization for frequency transitions */ bool transition_ongoing; /* Tracks transition status */