Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1577006imu; Wed, 9 Jan 2019 22:24:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7I+5Wnw7qxng/0iVM138nbRNph/t4Ercv+mHVx02XhLKI3b8AWuL7oG/nGa4SFMDgYNNux X-Received: by 2002:a63:451a:: with SMTP id s26mr8368274pga.150.1547101446098; Wed, 09 Jan 2019 22:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547101446; cv=none; d=google.com; s=arc-20160816; b=JGiwG8qZ/pwt7qwhxfgoKH3z3a6FlAhNFdt4cUp8ItYcK5tjXxaugtg9bxLPTplCw7 SkKbDPvtVOG6NnRcdre7LU0C0IuRAmEXx0JmFIj+zfmSOWWGf00K7TGQ5V44MDXiJnDN /B7wjUMQWjnzsAooHeyQAJkcMmBGkAf8vUoBffJzg12ikhMUGA14r6mZDbbxO2P05pYH rSK/9zZEqdRmABT+7t1pkjO7gxY2GaQpHPSOEuUmwGzRVXNnHlW10IBA4LWcQ+2tsNH/ iuF2sQkZ05OapKmzDcESAZ6TwhEoKp4zF1ucRuX+DkDQOymMK3Sf+Bki5XPNRukZKXKh niMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7kSoE1otNeDSansIN8QBD/iK4dJ5xymaADb++4gEuGg=; b=mSc5QSALzO3lOaWnjSo7//zhXg1SM/yGWPMF/NUPdbRHlmS7XiIpTCT4Sonz4NGGyZ RvoKi5buirDH0nRz2rmwe1MT+3UeoLtzFkEuXyujEy2c0CRVhteyZkYvY7yLXuHK5d77 OHwKmz8B7lQeFe2LwRnRo5o6T32THsB042w74s/87bKZncvTG2Hq/no2dl8RIxXzjV8r 9rJXQh1FYqjEA2aIwomMp0HfJ4mvswCZjNRgTGtf9+fGXLyezWIEZw+jU0IFnPOWTotr e4sBKkR2WVAl4xQQlV08UtqyGdiC+ug3ArUtxwaKe33wfavwN/mYhI6ApGw0JxXuf1nv BaRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NmR8s7G4; 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 d8si2093682plo.196.2019.01.09.22.23.48; Wed, 09 Jan 2019 22:24:06 -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=NmR8s7G4; 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 S1727317AbfAJGOy (ORCPT + 99 others); Thu, 10 Jan 2019 01:14:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35012 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbfAJGOx (ORCPT ); Thu, 10 Jan 2019 01:14:53 -0500 Received: by mail-pf1-f193.google.com with SMTP id z9so4855217pfi.2 for ; Wed, 09 Jan 2019 22:14:53 -0800 (PST) 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=7kSoE1otNeDSansIN8QBD/iK4dJ5xymaADb++4gEuGg=; b=NmR8s7G4ojSRXWsUkMknri8EOMasQ4t7MtinjwBpFujzu2KyowW006CkONX858kcSN VC1l8JBHmlF2nZxUuooDX/SwoTs4GhhffXchJF+v/AvznvvE51D2S7iLcCEEQKPskZ9b dPcjBBLQgMc3llazGCN3tGIehDgC4DUy3OtRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7kSoE1otNeDSansIN8QBD/iK4dJ5xymaADb++4gEuGg=; b=b0I+Snt+46sSW8YHL+3cdCJJKZbkbPbF4OqWSw+FTjTRsmI4VwtSWggzgq0kn0YIWr DBs2QnJFML/Idx8kNIrJekmzSYNj8To9EZK5hB65Y4rJuQDPRJmFhvD4+S1vuqt9nDap 037zI0ic+VvAkBQTiM4xCFSsuKSTXBKhL97JxhqvjHu4hllpVryHA1U5FQ0Mv1ej8iLl iAdbtIRHJMLCs98bJuoxeqfd4SzxW388q8xrpnHWxajgI1sSGOgs9vWgx2eBcMo0BOlk qPuH4DrgmV7VAcwP8Rj6P0zCh+XWLegFLYk+zXtExfkGxyIP6xdHjAxKTkRRJQCPy8vT WOKQ== X-Gm-Message-State: AJcUukdJwDpqPC/fmjc9lz569YsDX+pB3+fDuPTTy9e6/9MeCLEuGcsw 7OlAgdpghGYk7pwx/0kkHp/KLQ== X-Received: by 2002:a63:7418:: with SMTP id p24mr8279057pgc.196.1547100892997; Wed, 09 Jan 2019 22:14:52 -0800 (PST) Received: from localhost ([122.166.131.155]) by smtp.gmail.com with ESMTPSA id w11sm90217076pgk.16.2019.01.09.22.14.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 22:14:52 -0800 (PST) Date: Thu, 10 Jan 2019 11:44:50 +0530 From: Viresh Kumar To: Amit Kucheria Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, andy.gross@linaro.org, tdas@codeaurora.org, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Amit Daniel Kachhap , Javi Merino , Zhang Rui , Daniel Lezcano , "open list:THERMAL/CPU_COOLING" Subject: Re: [PATCH v1 3/7] cpu_cooling: Add generic driver ready callback Message-ID: <20190110061450.tdvanixjr6zdajhb@vireshk-i7> References: <9cccfabf22ccae92dfd31175b57baab3206eac0d.1547078153.git.amit.kucheria@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9cccfabf22ccae92dfd31175b57baab3206eac0d.1547078153.git.amit.kucheria@linaro.org> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10-01-19, 05:30, Amit Kucheria wrote: > All cpufreq drivers do similar things to register as a cooling device. > Provide a generic call back so we can get rid of duplicated code in the > drivers. > > Signed-off-by: Amit Kucheria > Suggested-by: Stephen Boyd > --- > drivers/thermal/cpu_cooling.c | 18 ++++++++++++++++++ > include/linux/cpu_cooling.h | 9 +++++++++ > 2 files changed, 27 insertions(+) We may be doing this differently, but I found some other issues with the patch. > diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c > index dfd23245f778..5154ffc12332 100644 > --- a/drivers/thermal/cpu_cooling.c > +++ b/drivers/thermal/cpu_cooling.c > @@ -694,6 +694,7 @@ __cpufreq_cooling_register(struct device_node *np, > > cpufreq_cdev->clipped_freq = cpufreq_cdev->freq_table[0].frequency; > cpufreq_cdev->cdev = cdev; > + policy->cooldev = cdev; Why was this required ? The below routine was already doing it... > > mutex_lock(&cooling_list_lock); > /* Register the notifier for first cpufreq cooling device */ > @@ -785,6 +786,23 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy) > } > EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); > > +/** > + * generic_cpufreq_ready - generic driver callback to register a thermal_cooling_device > + * @policy: cpufreq policy > + */ > +void generic_cpufreq_ready(struct cpufreq_policy *policy) > +{ > + struct thermal_cooling_device **cdev = &policy->cooldev; > + > + *cdev = of_cpufreq_cooling_register(policy); ... here > + if (IS_ERR(*cdev)) { We never get an error here, only NULL. > + pr_err("Failed to register cpufreq cooling device for CPU%d: %ld\n", > + policy->cpu, PTR_ERR(cdev)); The of_cpufreq_cooling_register() routine already prints enough error messages on failures. > + cdev = NULL; This is a meaningless statement, perhaps you wanted to do *cdev = NULL :) -- viresh