Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6287382imu; Mon, 21 Jan 2019 06:25:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN5JYqjHdPyJ85JbD9kTPLi8VZwymV9Iapo5hcbMGuNTbpaRmWW5qGJ6Ez/UF+18ozg1+QVh X-Received: by 2002:a63:f201:: with SMTP id v1mr26615256pgh.232.1548080721221; Mon, 21 Jan 2019 06:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080721; cv=none; d=google.com; s=arc-20160816; b=nK0+78tE6yN9ybk+nSWrpbE7jI/YO6Pojx+0WJSCc6NfeatI+fVivj59pnZZTB4WWi Wk1Xajmm4VuakG4M4M0L2x1fNyI1rwKwuQDk2X0oNJ3LNgoxXPlckH1kbUPQ99UU1Pm8 CNEWUz5Ja7Wz02oB1cGndfdzfPijZCOmw1w8F7Hw5weQKv4ThlqNUdlTjfII3nIgd+KU J92xexU9QTEPRIxuu6ZcioiuWexKcuZXvXuv56q/0pu5AtfdC/6xtcNXSYaNybRFncX7 9n1OG/IsTd47MRSeQZtptmvp9kMT5Gx8IL2oxoIxFqdrjlD/Khn3rhehGZDa6vrdZG7U Mbnw== 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=dtHk7/+QGCTjFekyd8dDMNSjrVxFUNnVyEvOJvlFAEQ=; b=ms78NB3XmRd5L6WHiI7KAmoTGbtQJdCfHaytIO36uTu9LLQI+GqDWiRH8GwAGaxsj1 kfE82t6dF+FztdDaNGuMCOQahhH+1JYN3nF+DHC1526P5nDO0zjtQECRaRtOlhsKtuUO V1Dqu2CWUYhGDuwQWbWOyrbyz+3s4hpqVZEiJItgQfn7/zumcB1pUihEEv4h/G1hisBZ 3DX0HjgYSqD80PyDFzP72mhk2rQ72fvVq34p8HTo4X4T+mY+MXhFizfgsI+wGoBh22Iq CPAt1oOKa0MNtHPOIvSsOxtGSTZmHpXz6yLmjB3LwegBPb3ubItC/EyLG600Bl5aIvhs +Oew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OCaRjo75; 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 b2si12547176pgh.475.2019.01.21.06.25.06; Mon, 21 Jan 2019 06:25:21 -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=OCaRjo75; 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 S1729335AbfAUOYD (ORCPT + 99 others); Mon, 21 Jan 2019 09:24:03 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:33600 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729031AbfAUOYD (ORCPT ); Mon, 21 Jan 2019 09:24:03 -0500 Received: by mail-vs1-f68.google.com with SMTP id p74so12718390vsc.0 for ; Mon, 21 Jan 2019 06:24:02 -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=dtHk7/+QGCTjFekyd8dDMNSjrVxFUNnVyEvOJvlFAEQ=; b=OCaRjo75JhWwAkI/LMcQ8gKpvDMpdErmS6pUJ5gmHpMmpn1g37TPs445sEEnYuN5T5 aks6YEJsAEbzCOxFJPS3+ghTDywzaoOgjqht00FjJsKWpw9PTHciEH154FV1s9Zagnim u/602M3P8BuFMhFBI7iQDEb2LtlHk4c38gYoA= 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=dtHk7/+QGCTjFekyd8dDMNSjrVxFUNnVyEvOJvlFAEQ=; b=D38baPHa0+oAyfJZpoFEAoX56p/PalvY/PRQuh5EoVppSrJGNwtx3Bfbm20KDw2ssF Lux9ogkjlf9aUlab39xUZaJj7bxdCS3jgfsXxXTYR4pg+y+iE/g7eTJh7jm0k1cNv53K SEuowCTRRc/CQ9oWXOiD8d82lcVl99tr/XFkWobhWfGvesl50qrFZYBp1PtoKFhLgXBn 4LQ4BortwHVrBRlTg4Tz29IJJvReY05KxGY4iGbBhFORqgPy0TVwQAwD1ec8tzkc4Q1g hm5Qg+qKsvT+zGHP9Kx2Zg4N6Avbk2+bmDHx53P7xr/i0mfpNXXCVwS1Q4TLD1KhF6pM 7vuQ== X-Gm-Message-State: AJcUukfTU+t/pq843IdxZf3eQq9JCIXzznWWJH4quo7YW7kaR1lWL30J ofaMIfz9pvHn3irJdP4VUxWXJ10i0Qh4nub/rzJ9qA== X-Received: by 2002:a67:e0d4:: with SMTP id m20mr12629570vsl.182.1548080641551; Mon, 21 Jan 2019 06:24:01 -0800 (PST) MIME-Version: 1.0 References: <154751027198.169631.16299398103212295726@swboyd.mtv.corp.google.com> In-Reply-To: <154751027198.169631.16299398103212295726@swboyd.mtv.corp.google.com> From: Amit Kucheria Date: Mon, 21 Jan 2019 19:53:50 +0530 Message-ID: Subject: Re: [PATCH v2 4/9] cpufreq: Add a flag to auto-register a cooling device To: Stephen Boyd Cc: LKML , linux-arm-msm , Bjorn Andersson , Viresh Kumar , Eduardo Valentin , Andy Gross , Taniya Das , Douglas Anderson , Matthias Kaehlcke , "Rafael J. Wysocki" , Linux PM list 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 Tue, Jan 15, 2019 at 5:27 AM Stephen Boyd wrote: > > Quoting Amit Kucheria (2019-01-14 02:21:06) > > All cpufreq drivers do similar things to register as a cooling device. > > Provide a cpufreq driver flag so drivers can just ask the cpufreq core > > to register the cooling device on their behalf. This allows us to get > > rid of duplicated code in the drivers. > > > > Suggested-by: Stephen Boyd > > Suggested-by: Viresh Kumar > > Signed-off-by: Amit Kucheria > > --- > > drivers/cpufreq/cpufreq.c | 13 +++++++++++++ > > include/linux/cpufreq.h | 6 ++++++ > > 2 files changed, 19 insertions(+) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 6f23ebb395f1..7faebfc61e60 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -30,6 +30,7 @@ > > #include > > #include > > #include > > +#include > > Maybe this is supposed to be ordered alphabetically? If so, this should > be much higher. Fixed > > > > static LIST_HEAD(cpufreq_policy_list); > > > > @@ -1318,6 +1319,12 @@ static int cpufreq_online(unsigned int cpu) > > if (cpufreq_driver->ready) > > cpufreq_driver->ready(policy); > > > > + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) { > > + struct thermal_cooling_device **cdev = &policy->cooldev; > > + > > + *cdev = of_cpufreq_cooling_register(policy); > > + } > > This seems to be some complicated way of writing: > > policy->cooldev = of_cpufreq_cooling_register(policy); > > ? Indeed. Fixed. > > + > > pr_debug("initialization complete\n"); > > > > return 0; > > @@ -1411,6 +1418,12 @@ static int cpufreq_offline(unsigned int cpu) > > if (has_target()) > > cpufreq_exit_governor(policy); > > > > + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) { > > + struct thermal_cooling_device **cdev = &policy->cooldev; > > + > > + cpufreq_cooling_unregister(*cdev); > > Similar? I'm confused! > _un_register as opposed to register above. :-) Thanks for the review.