Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5139692ybl; Tue, 4 Feb 2020 08:24:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyP/EZPUhZPGlaNKix5TiBFvyyL5Z9G0aPKJHImr3k5OsRZO0hWzHgiOveoorgXVqR+RNKD X-Received: by 2002:a05:6808:7c7:: with SMTP id f7mr4097876oij.58.1580833458059; Tue, 04 Feb 2020 08:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580833458; cv=none; d=google.com; s=arc-20160816; b=yjXxkydg+lEr4Vpx4NNdZND5+6CXri1C1Ign+uRwtqeBZaJjXdVglLt9WHn2CKCZ3l mwNnt/+Ro0CDVjNbiei+q8oruRx/UYfsxxq+rEpIpA0UiqFnqhhIVUKz/BpofegYpVWC Ulc9MN3mhd6raqwuxTuJKINzBPsRCmo1bgaaDumX+U0spEF/smYIe0oBtnmJqNrX2uZs zVhyoVsngrH7hsir6gOwGkz35/niQ1iBpycV5x0Dq6ZrwsEufDqH1s1No8gScFxYBWzF h5IDwonVLzCe8xqZEU/nOT2SOpOeT6WcqZ9UT2VCGDs+bR4Z/No7ShJlXao/Ilo8YMug MLdg== 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=Ea6CDByKgSbDMkqbEgMOnAWDJppEuzPTacXPBXjbpgg=; b=ytUcihpdpvRNYhbq7U7vp2JJZtt/Gel9+h1MN0LaS8oqubtDZ07F05hVaywLvSzVas 5/874N4FxRttdUFuR9BejMmZBMYyjc1cVuGcexNebny1Qd5/mHMwZZuVuiQhKDaKo03s yme2rh2rolf3ndHhkh6pG1aOwKk1t85YIOwvMoC+tYLPpb0KsTNnfrSstii/YgnV95BN 6kFj9+vj2F8Vb0c9g/hnLU4JzDnqWXJdylUaL3O/2tWgdG9YqlwyKRVMTtyBiR+8wqag e+ASq0mMWG1JiPemDS6XS/h2REOxtSlc3gMZz20hwRS1ly2WFaqj0iwQjSLNYAwrkz1O B5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lXCbSwzx; 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 l5si11874431otn.35.2020.02.04.08.24.03; Tue, 04 Feb 2020 08:24: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; dkim=pass header.i=@linaro.org header.s=google header.b=lXCbSwzx; 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 S1727359AbgBDQXJ (ORCPT + 99 others); Tue, 4 Feb 2020 11:23:09 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:45138 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727317AbgBDQXJ (ORCPT ); Tue, 4 Feb 2020 11:23:09 -0500 Received: by mail-vk1-f195.google.com with SMTP id g7so5319451vkl.12 for ; Tue, 04 Feb 2020 08:23:08 -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=Ea6CDByKgSbDMkqbEgMOnAWDJppEuzPTacXPBXjbpgg=; b=lXCbSwzxafLM6raSAdWogoEHnO/mTBZD3bcocFBdYquY+ylaHskUaAIPOpm5ZF4vfe 5G+IMeYmCFkLMv2064sPCqXmUD5JjEVGGnhFN4QptJL9Ffy0ppVxkro0Qb+pTTlyo3gX qzYbZsN7wrNsiOQKPuhW3cv1pUnsW9CbWE53RSyVpL9YQITT1a+Rfr0M1d1LwwgDrf0C RT04I35DZYseJxv8/qZx96j89aQhI8gcRQTByB5eGO1Pxz+rB1R7rZH5FEhk+VualXt7 eB/RTzHU+uERuUQ1xAP7Xf7Q4fdYZwhhSYjJ1HdbJ4kTHqHylJaNzyc1oFsXNYNAGzLl Oz+Q== 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=Ea6CDByKgSbDMkqbEgMOnAWDJppEuzPTacXPBXjbpgg=; b=MhgeGVWhBVl9oML9+DPxqfQlpFBqCrZ+Uh9xuxIrDaGy4CXBhAhyg2sz/s1y5GKxLy NVwCUevrc9SzWCfeyVnIJh2QxCv0JTyFFMJ1jJDx6cr+6lLzq02mkmsHoGgF2ibrFoeN HAFGHe9rHZ7PaOOEp1R2EgDRksX4RVtLTGzAy7CuEMYkLJ20IapKQtGLQFPc7m00EDxQ r2fgpC5EjCTHDYnlIBEnxO0UonZM7ijI5NO0o62omVOB6Q2eVW1ciBBukHzTbrOw6WuJ /zxEuhAa+qApzC0TTO0clFn84HTqcRbz1TviZdJFA5plMM4BNhPg6HIT7Zy3b+CIpH2E JrSw== X-Gm-Message-State: APjAAAWUIPrg0XB9BTZX2rvnHcBbjy1AH7lXGLqRrYEwdV138uecyQM3 CNqKaWviDI/1KWSFm3x9zf0mQDLDs3Wl0DcVZAyNIQ== X-Received: by 2002:a1f:914b:: with SMTP id t72mr18118471vkd.101.1580833387699; Tue, 04 Feb 2020 08:23:07 -0800 (PST) MIME-Version: 1.0 References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> <1574254593-16078-4-git-send-email-thara.gopinath@linaro.org> In-Reply-To: <1574254593-16078-4-git-send-email-thara.gopinath@linaro.org> From: Ulf Hansson Date: Tue, 4 Feb 2020 17:22:31 +0100 Message-ID: Subject: Re: [Patch v4 3/7] thermal: core: Allow cooling devices to register a parent. To: Thara Gopinath Cc: Eduardo Valentin , Zhang Rui , Daniel Lezcano , Bjorn Andersson , Andy Gross , Amit Kucheria , Mark Rutland , "Rafael J. Wysocki" , Linux PM , DTML , linux-arm-msm , Linux Kernel Mailing 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 Wed, 20 Nov 2019 at 13:56, Thara Gopinath wrote: > > With introduction of power domain warming devices, devices that control the > power domain are registered as the parent of the cooling device so that the > device-genpd hierarchy in kernel is maintained intact. To enable this, > introduce a new API thermal_of_cooling_device_parent_register that takes a > parent device pointer as input. Also, modify > __thermal_cooling_device_register to register parent of a newly created > cooling device, if specified. I am not sure I understand the reasons why you need this, can you please elaborate? I remember we talked about using a "parent" device to deal with device attaching to PM domains (genpd). However, since the DT bindings for "warming devices" was concluded to consist by a single property ("#cooling-cells") as a part of the PM domain provider node, this seems not to be needed. By looking at patch 4/7, you are attaching devices via of_genpd_add_device() and I don't see any need for using a "parent" in there. Can $subject patch be dropped or what am I missing? Kind regards Uffe > > Signed-off-by: Thara Gopinath > --- > drivers/thermal/thermal_core.c | 22 +++++++++++++++++++--- > include/linux/thermal.h | 15 +++++++++++++++ > 2 files changed, 34 insertions(+), 3 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index d4481cc..912ba75 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -947,6 +947,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev) > */ > static struct thermal_cooling_device * > __thermal_cooling_device_register(struct device_node *np, > + struct device *parent, > const char *type, void *devdata, > const struct thermal_cooling_device_ops *ops) > { > @@ -979,6 +980,8 @@ __thermal_cooling_device_register(struct device_node *np, > cdev->ops = ops; > cdev->updated = false; > cdev->device.class = &thermal_class; > + if (parent) > + cdev->device.parent = parent; > cdev->devdata = devdata; > thermal_cooling_device_setup_sysfs(cdev); > dev_set_name(&cdev->device, "cooling_device%d", cdev->id); > @@ -1024,7 +1027,8 @@ struct thermal_cooling_device * > thermal_cooling_device_register(const char *type, void *devdata, > const struct thermal_cooling_device_ops *ops) > { > - return __thermal_cooling_device_register(NULL, type, devdata, ops); > + return __thermal_cooling_device_register(NULL, NULL, type, > + devdata, ops); > } > EXPORT_SYMBOL_GPL(thermal_cooling_device_register); > > @@ -1048,10 +1052,22 @@ thermal_of_cooling_device_register(struct device_node *np, > const char *type, void *devdata, > const struct thermal_cooling_device_ops *ops) > { > - return __thermal_cooling_device_register(np, type, devdata, ops); > + return __thermal_cooling_device_register(np, NULL, type, devdata, ops); > } > EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); > > +struct thermal_cooling_device * > +thermal_of_cooling_device_parent_register(struct device_node *np, > + struct device *parent, > + const char *type, void *devdata, > + const struct > + thermal_cooling_device_ops *ops) > +{ > + return __thermal_cooling_device_register(np, parent, type, > + devdata, ops); > +} > +EXPORT_SYMBOL_GPL(thermal_of_cooling_device_parent_register); > + > static void thermal_cooling_device_release(struct device *dev, void *res) > { > thermal_cooling_device_unregister( > @@ -1088,7 +1104,7 @@ devm_thermal_of_cooling_device_register(struct device *dev, > if (!ptr) > return ERR_PTR(-ENOMEM); > > - tcd = __thermal_cooling_device_register(np, type, devdata, ops); > + tcd = __thermal_cooling_device_register(np, NULL, type, devdata, ops); > if (IS_ERR(tcd)) { > devres_free(ptr); > return tcd; > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index e45659c..ac5f268 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -448,6 +448,11 @@ struct thermal_cooling_device * > thermal_of_cooling_device_register(struct device_node *np, const char *, void *, > const struct thermal_cooling_device_ops *); > struct thermal_cooling_device * > +thermal_of_cooling_device_parent_register(struct device_node *np, > + struct device *parent, > + const char *, void *, const struct > + thermal_cooling_device_ops *); > +struct thermal_cooling_device * > devm_thermal_of_cooling_device_register(struct device *dev, > struct device_node *np, > char *type, void *devdata, > @@ -508,6 +513,16 @@ static inline struct thermal_cooling_device * > thermal_of_cooling_device_register(struct device_node *np, > char *type, void *devdata, const struct thermal_cooling_device_ops *ops) > { return ERR_PTR(-ENODEV); } > + > +static inline struct thermal_cooling_device * > +thermal_of_cooling_device_parent_register(struct device_node *np, > + struct device *parent, > + const char *, void *, const struct > + thermal_cooling_device_ops *) > +{ > + return ERR_PTR(-ENODEV); > +} > + > static inline struct thermal_cooling_device * > devm_thermal_of_cooling_device_register(struct device *dev, > struct device_node *np, > -- > 2.1.4 >