Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2896134ybb; Mon, 30 Mar 2020 15:30:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtYwOjjKLbcHzWqIdV+4lYnnG1JSIlpO/+Exh5qR+RTzWeMHx71Od4SeDyvfBhGR7qdTX1G X-Received: by 2002:a9d:554c:: with SMTP id h12mr1086579oti.16.1585607422803; Mon, 30 Mar 2020 15:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585607422; cv=none; d=google.com; s=arc-20160816; b=gchMkCxfp9T72f/cmVUY9ceKaLMSYigCQ81n1yxE/aCzb1YGrF72Tly3Lq6FpIYR8J Vczti1L7moxJOICZ6IDtFCi8YSCUCEm0FnLFRENq27yjmcHC/pijOowKyrVfnw1UFIom rxVRaKLwHoxqWarSXqglPXn2F6vNztthoRSBOT7NG1gAR3U3v276+xoBxaA1P22okKaQ K7MHRmNdOKwT9AgbVHzPlNNacfqiapDoC7kGXHcGQWrPQBGzMBF6jzdcfuoDRVKwm13N +4IPp8rt9KYgQLNsfjw5ULtJ8l6TeoDeB5Lx69zhoL2xkLhfi2aurOaw7IvBNtJB416G Kv9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=O8vQmmg7hNSl880dzS5U4D8ylPA2t24t6PDXIkjFhyw=; b=zsQDPLHO1FskNMDq8s7wV8cvhHo+1oOfqwLi+dKx7N+vumgIrlGP6UbHrqtPSwDA1W 75GtJieMt2BfVwW2K7eTnzl3k4jB+zsbLt5yRXjORqSFOrJSTIDDJry6r0gtkRmJqRsr woyfw9XkR3dS5/EDkgFemd3zNJ6tr/dDBumS+JcAQFjsBEonU1ggT/dT60P6AHQwXtl3 2SplGdtdY1n2xH/66gUyQqayQEVVMyFOW8QTKGDQDL6MD3UjDJyEegbZ1p8BSP/DFj5s iSSXpAhmzbMlqFTlg5uhg7CzgR5Hem66F9DHmSRjn9xanHify6U3CGMUvNEoR0+JABaH CQrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=enaoigUV; 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 f21si7055346otf.31.2020.03.30.15.30.09; Mon, 30 Mar 2020 15:30:22 -0700 (PDT) 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=enaoigUV; 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 S1729491AbgC3W3j (ORCPT + 99 others); Mon, 30 Mar 2020 18:29:39 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42406 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729426AbgC3W3i (ORCPT ); Mon, 30 Mar 2020 18:29:38 -0400 Received: by mail-pl1-f194.google.com with SMTP id e1so7317673plt.9 for ; Mon, 30 Mar 2020 15:29:37 -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; bh=O8vQmmg7hNSl880dzS5U4D8ylPA2t24t6PDXIkjFhyw=; b=enaoigUVvJO5lyNNbZ/eEngJDp3NLSbXaOW8jZMXRUmub8ne5NS0p2geytGwCNQhNo XgeGgxBkDSUWgWGKpRxnhHWbYuC+j6er51oCUnB/RC16US6Q+bgZj2EVcsUFu4QdmJKz VNedjGXM3sPPcxywmqhCVBX9zf2x5RN+C5cPU59YLceEVi8oVO9idqlgMe8G0fipax4l OThjTm38AALbmpbzI/QhQM9SxvoafBFBUMqK0mC4pzNkrxdCOZNZQDs/Y7JhASw8hKIv 4NB+RAvstoycLWvAu/duRBk1nRUqYutikF6uLdIJ7WqN8UoEs/7TFZkf0Y5vuEOk88NH vx0g== 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; bh=O8vQmmg7hNSl880dzS5U4D8ylPA2t24t6PDXIkjFhyw=; b=e91n45+nAGPvqA8vBjlbf9ziaEYv5jFTMHWeNvaB6dFa305tdMwOaEm69x82CRM/EF TEnBc190k0pnWFiYvySM2MBtmLJBSbGm0LoA8btxYb5aOQI3BJmOhO068qjq1nw97ung tYRK/9FeMEOtSFT/er6l/wau4lyNC8IAjqCMRcYcObiFMiGng+4Zny+0MYk5a/moPbQe Ena0mXKRkFeiLlTsfvZSrAHDMdlV/ywlJpTjHn7PCZFrFA7PSjtJBOiLicBjkGcX191b elf7/VKXN7VeuiGaphBwUCw5xHXH9TC3V7RaIK6hLiDUZJ0ofbLjcqe8jDCq1gsZC/Rp QKCQ== X-Gm-Message-State: AGi0PubEVuEZoZ16cfMfHoc6XOutxloFBQwuHYyfQ3AAENjUUlocXZxQ GiDOFjNguUw6abQ7xpkJdiJwyg== X-Received: by 2002:a17:90a:8087:: with SMTP id c7mr346640pjn.148.1585607376669; Mon, 30 Mar 2020 15:29:36 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id v42sm10448437pgn.6.2020.03.30.15.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 15:29:36 -0700 (PDT) Date: Mon, 30 Mar 2020 15:29:33 -0700 From: Bjorn Andersson To: Thara Gopinath Cc: rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, agross@kernel.org, robh@kernel.org, amit.kucheria@verdurent.com, mark.rutland@arm.com, rjw@rjwysocki.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Patch v5 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices. Message-ID: <20200330222933.GC215915@minitux> References: <20200320014107.26087-1-thara.gopinath@linaro.org> <20200320014107.26087-5-thara.gopinath@linaro.org> <20200327225345.GH5063@builder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 30 Mar 07:53 PDT 2020, Thara Gopinath wrote: > On 3/27/20 6:53 PM, Bjorn Andersson wrote: > > On Thu 19 Mar 18:41 PDT 2020, Thara Gopinath wrote: [..] > > > +static int __init rpmhpd_init_warming_device(void) > > > +{ > > > + size_t num_pds; > > > + struct rpmhpd **rpmhpds; > > > + int i; > > > + > > > + if (!global_desc) > > > + return -EINVAL; > > > + > > > + rpmhpds = global_desc->rpmhpds; > > > + num_pds = global_desc->num_pds; > > > + > > > + if (!of_find_property(rpmhpds[0]->dev->of_node, "#cooling-cells", NULL)) > > > + return 0; > > > + > > > + for (i = 0; i < num_pds; i++) > > > + if (rpmhpds[i]->is_warming_dev) > > > + of_pd_warming_register(rpmhpds[i]->dev, i); > > > + > > > + return 0; > > > +} > > > +late_initcall(rpmhpd_init_warming_device); > > > > ...why can't this be done in rpmhpd_probe()? > > > > In particular with the recent patches from John Stultz to allow rpmhpd > > to be built as a module I don't think there's any guarantees that > > rpmh_probe() will have succeeded before rpmhpd_init_warming_device() > > executes. > > It is to take care of boot order. Understood. > So this has to happen after the thermal framework is initialized. Thermal > framework is initialized with core_initcall. Can I move the rpmhpd init as a > postcore_initcall ? Then I can get rid of this separate function and keep it > as part of probe. > So I presume the problem is that if this is called from probe, you might of_pd_warming_register(), which ends up in __thermal_cooling_device_register() before thermal_init() has been invoked? Which is bad because e.g. thermal_class is not yet initialized. I don't want to rely on the order of initcalls for things to work, so could we make this more robust by having thermal_of_cooling_device_register() return -EPROBE_DEFER is thermal_init() isn't done? Regards, Bjorn