Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1714590imu; Thu, 10 Jan 2019 01:35:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Q1E8gR22UdwwPpgTnHsoZhoNKH6dGuQEG7OUmEikqsZPHYM+XobVlOEXMt1DnCnXv1JpL X-Received: by 2002:a63:4c04:: with SMTP id z4mr8814332pga.312.1547112918880; Thu, 10 Jan 2019 01:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547112918; cv=none; d=google.com; s=arc-20160816; b=GPsmivveidKPPANG7rqb8Guaw9SYU2+SgvltwKI3UlNdMyA9uN9A2787sP1SgIVKp3 LHm2K3F4Qs1q3sY5IoXqoG0oLH+OvrHwxhPROTYUF/JKZ5NfDQmdanJZVHbpG9W6MuVN Tr3XPr0i+V27XwXqdgS+obOlcy8xG4u8ScjrT6+YqIiH1ULtNKvbQs9NxcTxN7jxia3d zVsbjBhYXNbbjU5fppJQtOCqo1XGLdfSGDKehR8u9A5fZFSe64FPV/ougQk7S90I0DMJ f8fmPBhhyT3T+fiZ9oTAKPTmKZRfgG5Kusnghf9SsArk/5Zr7qKK3AIpMJZhobasj8j2 r5Lw== 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; bh=pWe8aiOlfHkTiEPAme+y+3DxEA3ueHtWT4PQaYLhd+c=; b=XC7xkD7jiGzw115/gpJM/qB6MLe2pus3EHRgNYF5Ycv1kGUineplE1p3NzYpCoVGZN xRuM+q0nAuTLH18YUti/NE+yhmjswO0eKK83OtZVbuEvFlW36O4+dpXGIHdZKkatWRhy YWpYFQaZalrg5IyAC2surkY25C2cjXk8tpXd8I+E+3dXIsrWw4ue0TZSkrYddy38wHpm cyTq/lL9ZYMwlLl+lCIur9huNydCK33Ef4bAUaaUbPlksWVWyniMjWC1wahYyAdpPcPV pAZ+riSSsb4vEkFn1iZW80EjBiVzuHTXkvwVQInabA+0xbbEBn/xIiqpWB5yipBQWwj/ cSBA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si22510952pgj.60.2019.01.10.01.35.03; Thu, 10 Jan 2019 01:35:18 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbfAJJcf (ORCPT + 99 others); Thu, 10 Jan 2019 04:32:35 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:43114 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727826AbfAJJce (ORCPT ); Thu, 10 Jan 2019 04:32:34 -0500 Received: by mail-ot1-f68.google.com with SMTP id a11so9341159otr.10; Thu, 10 Jan 2019 01:32:33 -0800 (PST) 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=pWe8aiOlfHkTiEPAme+y+3DxEA3ueHtWT4PQaYLhd+c=; b=uY+GQE2RIkditXJlaTXwUGzjSoMFLwgLIHeKRAml/uUsrTNwGlndM4w9EGZMfaGVqf Udcl21jropgOrpS9w/ALZSkbHflqariO6a+zzQav4IOZZHM4pPPoh2iAfe0EqFW7gVIS VaqPd7uY2dS4leSUqOVNA38Pyjk1aydSBB148Ye9/BWFaUimLq/518c5atbvKlHiOda2 LAWEr1uKb/PvtG8H+LLNcPq5RrsuQDBTqhCs+hjvUzkt3CmhugpbqY1ufP+aOtg9/rE2 e6irbNxrv/eQ9KF9g/Yv4Xo38R86ZxAN/8rsakdo7wHuoSwnQzIH6K/TpvE3yg4DE1p+ +5EQ== X-Gm-Message-State: AJcUukdIaBgO1e/5DqNpnOuB++KncoV/l6NcOM3f7XX5bOvpb9UEkQ1V wwEpyrMvFd/0//TuQIclB/osM5265AhmND2N6nU= X-Received: by 2002:a9d:60b:: with SMTP id 11mr6099001otn.200.1547112753154; Thu, 10 Jan 2019 01:32:33 -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: "Rafael J. Wysocki" Date: Thu, 10 Jan 2019 10:32:19 +0100 Message-ID: Subject: Re: [PATCH v1 5/7] cpufreq: qcom-hw: Register as a cpufreq cooling device To: Viresh Kumar Cc: Amit Kucheria , Linux Kernel Mailing List , linux-arm-msm , bjorn.andersson@linaro.org, Eduardo Valentin , Andy Gross , Taniya Das , Stephen Boyd , Doug 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 7:12 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. > > @Rafael: What do you say ? Getting rid of code duplication is good, let's do that.