linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Thara Gopinath <thara.gopinath@linaro.org>
Cc: Eduardo Valentin <edubezval@gmail.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Amit Kucheria <amit.kucheria@verdurent.com>,
	Mark Rutland <mark.rutland@arm.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	DTML <devicetree@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Patch v4 3/7] thermal: core: Allow cooling devices to register a parent.
Date: Tue, 4 Feb 2020 17:22:31 +0100	[thread overview]
Message-ID: <CAPDyKFozvt-LdxwkCB9C+t-mR-CZ37HigsB88z9Tj_SzKfRBLg@mail.gmail.com> (raw)
In-Reply-To: <1574254593-16078-4-git-send-email-thara.gopinath@linaro.org>

On Wed, 20 Nov 2019 at 13:56, Thara Gopinath <thara.gopinath@linaro.org> 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 <thara.gopinath@linaro.org>
> ---
>  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
>

  reply	other threads:[~2020-02-04 16:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 12:56 [Patch v4 0/7] Introduce Power domain based warming device driver Thara Gopinath
2019-11-20 12:56 ` [Patch v4 1/7] PM/Domains: Add support for retrieving genpd performance states information Thara Gopinath
2019-11-20 12:56 ` [Patch v4 2/7] soc: qcom: rpmhpd: Introduce function to retrieve power domain performance state count Thara Gopinath
2020-02-04 16:10   ` Ulf Hansson
2019-11-20 12:56 ` [Patch v4 3/7] thermal: core: Allow cooling devices to register a parent Thara Gopinath
2020-02-04 16:22   ` Ulf Hansson [this message]
2019-11-20 12:56 ` [Patch v4 4/7] thermal: Add generic power domain warming device driver Thara Gopinath
2020-02-04 16:54   ` Ulf Hansson
2020-03-01 23:00     ` Thara Gopinath
2020-03-13 13:13       ` Ulf Hansson
2020-03-13 15:02         ` Thara Gopinath
2019-11-20 12:56 ` [Patch v4 5/7] soc: qcom: Extend RPMh power controller driver to register warming devices Thara Gopinath
2020-02-04 17:40   ` Ulf Hansson
2020-03-01 23:36     ` Thara Gopinath
2019-11-20 12:56 ` [Patch v4 6/7] dt-bindings: soc: qcom: Extend RPMh power controller binding to describe thermal warming device Thara Gopinath
2019-11-22 23:59   ` Rob Herring
2020-02-04 17:41   ` Ulf Hansson
2020-03-01 23:37     ` Thara Gopinath
2019-11-20 12:56 ` [Patch v4 7/7] arm64: dts: qcom: Indicate rpmhpd hosts a power domain that can be used as a " Thara Gopinath
2020-02-04 17:40   ` Ulf Hansson
2020-01-09 15:02 ` [Patch v4 0/7] Introduce Power domain based warming device driver Thara Gopinath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFozvt-LdxwkCB9C+t-mR-CZ37HigsB88z9Tj_SzKfRBLg@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=agross@kernel.org \
    --cc=amit.kucheria@verdurent.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@linaro.org \
    --subject='Re: [Patch v4 3/7] thermal: core: Allow cooling devices to register a parent.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).