From patchwork Fri Jul 22 15:13:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 72628 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1048708qga; Fri, 22 Jul 2016 08:13:56 -0700 (PDT) X-Received: by 10.66.185.14 with SMTP id ey14mr7416358pac.71.1469200436014; Fri, 22 Jul 2016 08:13:56 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si16294618pfk.163.2016.07.22.08.13.55; Fri, 22 Jul 2016 08:13:56 -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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751082AbcGVPNk (ORCPT + 14 others); Fri, 22 Jul 2016 11:13:40 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:35778 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751787AbcGVPNa (ORCPT ); Fri, 22 Jul 2016 11:13:30 -0400 Received: by mail-pa0-f51.google.com with SMTP id iw10so40441780pac.2 for ; Fri, 22 Jul 2016 08:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=B76Jx0MyKnW656lLsG+oMtkqMZT7Q0o2NIm3Iev4qr4=; b=SE7lDQbZxsQPyPzN05FOZwqXEZt5ImCS9P+BUT8JMoa6CdeXCnynpOgpqSD5CuL2hn WxU3Dv7glAoWzakEaj/RznblMclOIVwQb2M3Yohw22sJ7MCvjavyBd2MGdCJtkGQmrDs 4VSguUiuEfZ7/9OVCN23+3FyHdBShSu3oBNLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=B76Jx0MyKnW656lLsG+oMtkqMZT7Q0o2NIm3Iev4qr4=; b=OddrMximXWLa/gDot62TSCeMIk9BKF7lVK8iaexDg2oYqs7zF1QZM74hS7ScfkA3WR mbBdJJ+8qre9R9PpRzVOtwlYct5bc41o9q9A6JGEVPJDf4jEbbWv086/1emUKryw+cr3 SJaCOh3aB5wLsQItiCvwmFFr8Xxxa9bVkW6bGBYrB5Eg129sdvgr4WSnhEmPm02r9+0X ISZ+Q6Vg21QW+yyz0ZkWU8jbA647LwaH03dfo3RO+t0OVHzgqMa1ZIfoiH/gGy4n1hOz 1AeXpV9XW3l5Vvnt8SWOgcxB3jGgoTg3vPmLknnp6T75wJDaFg3p6SHRM0YWWKOeoGny 0KjQ== X-Gm-Message-State: AEkoousec5i0bHvrW7sQiJynkXk8xKa8Ebahv7YYOs+M3CYAxHLmJQ3cGLxqHPJruL5ehrRA X-Received: by 10.66.15.138 with SMTP id x10mr7265251pac.92.1469200409449; Fri, 22 Jul 2016 08:13:29 -0700 (PDT) Received: from localhost ([104.132.1.108]) by smtp.gmail.com with ESMTPSA id f84sm20794404pfd.87.2016.07.22.08.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jul 2016 08:13:28 -0700 (PDT) Date: Fri, 22 Jul 2016 08:13:27 -0700 From: Viresh Kumar To: Steve Muckle Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Lists linaro-kernel , Linux PM , Linux Kernel Mailing List , Peter Zijlstra , Ingo Molnar , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi Subject: Re: [PATCH V2] cpufreq: Disallow ->resolve_freq() for drivers providing ->target_index() Message-ID: <20160722151327.GP3122@ubuntu> References: <065301260510fbca81f5481b27b0de956073068a.1469137133.git.viresh.kumar@linaro.org> <1490801.bHMYROVPDC@vostro.rjw.lan> <20160721232228.GT27987@graphite.smuckle.net> <20160721234558.GX27987@graphite.smuckle.net> <20160722000903.GY27987@graphite.smuckle.net> <20160722003405.GZ27987@graphite.smuckle.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160722003405.GZ27987@graphite.smuckle.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 21-07-16, 17:34, Steve Muckle wrote: > On Fri, Jul 22, 2016 at 02:18:54AM +0200, Rafael J. Wysocki wrote: > > > My thinking was that one of these two would be preferable: > > > > > > - Forcing ->target() drivers to install a ->resolve_freq callback, > > > enforcing this at cpufreq driver init time. > > > > That would have been possible, but your series didn't do that. > > > > > My understanding is > > > ->target() drivers are deprecated anyway > > > > No, they aren't. > > Ok. I didn't follow Documentation/cpu-freq/cpu-drivers.txt section 1.5 > then - it suggests something about target() is deprecated, perhaps it's > out of date. They are kind of deprecated for the new uesrs, but we still have handful of users of it. > Sorry, that should've been "check that either ->target_index() or > ->resolve_freq() is implemented." > > Implementing resolve_freq for the target() drivers and requiring it at > driver init time is probably the better way to go though. Perhaps I can > work on this at some point. As I said earlier as well in one of the emails, if you are worried about the extra 'if' check in the hot path, then wouldn't this fix it for you? -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3dd4884c6f9e..91d8ec4c8eb7 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -517,7 +517,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, return policy->freq_table[idx].frequency; } - if (cpufreq_driver->resolve_freq) + if (likely(cpufreq_driver->resolve_freq)) return cpufreq_driver->resolve_freq(policy, target_freq); return target_freq;