Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1691326imu; Thu, 10 Jan 2019 01:05:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4o1bAB8Lf9pYOGF+zeV3BJ02AlTLYk6FiHt+Lgb28Un7YFeUSGpC2cXuZNeDx1ofW7N0Xd X-Received: by 2002:a65:434d:: with SMTP id k13mr8653902pgq.269.1547111119593; Thu, 10 Jan 2019 01:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547111119; cv=none; d=google.com; s=arc-20160816; b=GRXiizBFVK5QZHHAYf7XcyuYi0os70GaYXpThjYNS+TXfK9iTNBltvQwvy4+X23hQP 06f5Xgs3XlHguT2+hJROKAuWCt6zylGklzgL8mWlvhqlPnJU1IydzpXP29FY4Nzd7dVm nW4XiniurSsk6JVl1JAaZk6Siw5m4ceq/BQQF/2uQkq3R0KvM+nJZ9eCZ5JvM160BvOD nWlK+r/CD8T+IYxi295GN54gXU2RzmCDx6KGsA3pNAYNbSBtn+KY79bLi28zZ0LC9H46 XwcA5TJTwOQlvg3UXk2rrCD/Cg/3kleZWdWANWQePLtREGvzclDmdqdrryjYWP3m3EXo yCQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Cq/LJE+M2szGt0iqQyBFymvPRV2Wpa+Cosev17WtFYw=; b=E6c4OUdksQm/Kk9nCh6lfP1Pjykvws9UYsIlz8o9gxIW2BGS2UPoojBnu5IdwjClcx z5QkC6qyJEp0ZeBPAhymEYqJmv1MDNxwWkrvPZ9VIWxUJFK23RhDL9d4DsCYMFWrtOpv OqtQgFkFBWu84917MUyFbvvIeqxiaKL33lC0VUluSSc7donRGwX5gKNT9+BeiUDA36el uYFDozvZQJAjFCBI2c6rY/ZHor6cWl+BDjqAUR/sZMCOyw3Xewh+2MbEP/bcM6IKb7an 5kL6LM+ZQsGIpT/gYZWd/ojc86g5UJez1xf5Ow0bd4r3vI5b+1m5MoFw1usvByLyD/Sv d89w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EY1cxcFT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 a6si8860687pfo.90.2019.01.10.01.05.03; Thu, 10 Jan 2019 01:05:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=EY1cxcFT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727759AbfAJJDo (ORCPT + 99 others); Thu, 10 Jan 2019 04:03:44 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:37273 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727220AbfAJJDn (ORCPT ); Thu, 10 Jan 2019 04:03:43 -0500 Received: by mail-vs1-f65.google.com with SMTP id n13so6562071vsk.4 for ; Thu, 10 Jan 2019 01:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cq/LJE+M2szGt0iqQyBFymvPRV2Wpa+Cosev17WtFYw=; b=EY1cxcFTAfs7Ai9Pnyl+8lbFw2ccyvPu2LW3zAMhb5anwaqjci4JNKHgSNKyNRP1yr QpGz/2//c9va1ms0ai93dzZhrKqNdDvh2GDsMl/QfxE/FSPDaEEgsDLkrutu571CPn8E FYAZTPNBvR9VMJ2blC5O/lJ/avoJGl62V2M1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cq/LJE+M2szGt0iqQyBFymvPRV2Wpa+Cosev17WtFYw=; b=gFrypE2zgdE08oT6boP3ks4asoOT+RLcHIdFu9pWKsZh7ChVy8eZD0TXS1STQnbx3b 0/dS3k3J1aaWvPO/uYki+/yMonVsZnlfyf5kMIljol3A0QuerZu5RUpYKe3DI2edYPJB Fjl496BBy9fTElCDMpOYdA7nH/2TSQ0lvM8zU3BaiVjcsY6I3ivz5YzWC5rS7mRTl4dg +HZ+MIrOV8M6AZdrmD4aLqgYRy5sLJAVOMGAuQS+1ywN0waetY+TLruDi56gS01dlWlZ bE1SmdDpVryWmU5DyKhO7dCK0/SXhq2UVD4C03MJiGZuLEnZ78ygz0OGEOuBPjlU4QVE id4A== X-Gm-Message-State: AJcUukd1qR/KTXVjGBy5oLalArOgxaE5Ocro19yc2SxVTWadDN1xin1X 6pQZ4LfP+/HKzLhnzed9VlvE+C0UHzQ+fB+Er5CnYA== X-Received: by 2002:a67:e0d4:: with SMTP id m20mr3970609vsl.182.1547111022238; Thu, 10 Jan 2019 01:03:42 -0800 (PST) MIME-Version: 1.0 References: <3c7d0e4a8373e89d6922543ccf56749970de5567.1547078153.git.amit.kucheria@linaro.org> <20190110061210.lz5i5wf7wxh22q7c@vireshk-i7> In-Reply-To: <20190110061210.lz5i5wf7wxh22q7c@vireshk-i7> From: Amit Kucheria Date: Thu, 10 Jan 2019 14:33:31 +0530 Message-ID: Subject: Re: [PATCH v1 5/7] cpufreq: qcom-hw: Register as a cpufreq cooling device To: Viresh Kumar Cc: LKML , linux-arm-msm , Bjorn Andersson , Eduardo Valentin , Andy Gross , Taniya Das , Stephen Boyd , Douglas Anderson , Matthias Kaehlcke , "Rafael J. Wysocki" , "open list:CPU FREQUENCY DRIVERS" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 11:42 AM Viresh Kumar wrote: > > On 10-01-19, 05:30, Amit Kucheria wrote: > > Signed-off-by: Amit Kucheria > > --- > > drivers/cpufreq/qcom-cpufreq-hw.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c > > index 649dddd72749..1c01311e5927 100644 > > --- a/drivers/cpufreq/qcom-cpufreq-hw.c > > +++ b/drivers/cpufreq/qcom-cpufreq-hw.c > > @@ -5,6 +5,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -216,7 +217,10 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) > > static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy) > > { > > void __iomem *base = policy->driver_data - REG_PERF_STATE; > > + struct thermal_cooling_device *cdev = policy->cooldev; > > > > + if (cdev) > > + cpufreq_cooling_unregister(cdev); > > kfree(policy->freq_table); > > devm_iounmap(&global_pdev->dev, base); > > > > @@ -238,6 +242,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { > > .init = qcom_cpufreq_hw_cpu_init, > > .exit = qcom_cpufreq_hw_cpu_exit, > > .fast_switch = qcom_cpufreq_hw_fast_switch, > > + .ready = generic_cpufreq_ready, > > .name = "qcom-cpufreq-hw", > > .attr = qcom_cpufreq_hw_attr, > > }; > > I liked the idea of reducing code duplication, but not much the > implementation. All we were able to get rid of was a call to > of_cpufreq_cooling_register() and nothing else. Is it worth it ? > > Maybe we can add another flag in cpufreq.h: > > #define CPUFREQ_AUTO_REGISTER_COOLING_DEV (1 << 7) > > and let the core do it all automatically by itself, that will get rid > of code duplication actually. I like the idea of a flag. I'll spin something implementing it in the next rev. > @Rafael: What do you say ?