All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Kevin Hilman <khilman@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Qais.Yousef@arm.com, Matthias Kaehlcke <mka@chromium.org>,
	juri.lelli@gmail.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3 1/5] PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier()
Date: Mon, 17 Jun 2019 11:23:19 +0200	[thread overview]
Message-ID: <CAPDyKFqiwVbmbnOZzpT-yokwwWrRTYXgmBtuUsdawEd3D0ySqQ@mail.gmail.com> (raw)
In-Reply-To: <c263629a53dba33f9e7190b82172a88cc79654d1.1560163748.git.viresh.kumar@linaro.org>

On Mon, 10 Jun 2019 at 12:51, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> In order to use the same set of routines to register notifiers for
> different request types, update the existing
> dev_pm_qos_{add|remove}_notifier() routines with an additional
> parameter: request-type.
>
> For now, it only supports resume-latency request type.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe


> ---
>  Documentation/power/pm_qos_interface.txt | 10 ++++++----
>  drivers/base/power/domain.c              |  8 +++++---
>  drivers/base/power/qos.c                 | 14 ++++++++++++--
>  include/linux/pm_qos.h                   | 12 ++++++++----
>  4 files changed, 31 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt
> index 19c5f7b1a7ba..ec7d662d1707 100644
> --- a/Documentation/power/pm_qos_interface.txt
> +++ b/Documentation/power/pm_qos_interface.txt
> @@ -164,12 +164,14 @@ directory.
>  Notification mechanisms:
>  The per-device PM QoS framework has a per-device notification tree.
>
> -int dev_pm_qos_add_notifier(device, notifier):
> -Adds a notification callback function for the device.
> +int dev_pm_qos_add_notifier(device, notifier, type):
> +Adds a notification callback function for the device for a particular request
> +type.
> +
>  The callback is called when the aggregated value of the device constraints list
> -is changed (for resume latency device PM QoS only).
> +is changed.
>
> -int dev_pm_qos_remove_notifier(device, notifier):
> +int dev_pm_qos_remove_notifier(device, notifier, type):
>  Removes the notification callback function for the device.
>
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 33c30c1e6a30..b063bc41b0a9 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1536,7 +1536,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
>         if (ret)
>                 genpd_free_dev_data(dev, gpd_data);
>         else
> -               dev_pm_qos_add_notifier(dev, &gpd_data->nb);
> +               dev_pm_qos_add_notifier(dev, &gpd_data->nb,
> +                                       DEV_PM_QOS_RESUME_LATENCY);
>
>         return ret;
>  }
> @@ -1569,7 +1570,8 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
>
>         pdd = dev->power.subsys_data->domain_data;
>         gpd_data = to_gpd_data(pdd);
> -       dev_pm_qos_remove_notifier(dev, &gpd_data->nb);
> +       dev_pm_qos_remove_notifier(dev, &gpd_data->nb,
> +                                  DEV_PM_QOS_RESUME_LATENCY);
>
>         genpd_lock(genpd);
>
> @@ -1597,7 +1599,7 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
>
>   out:
>         genpd_unlock(genpd);
> -       dev_pm_qos_add_notifier(dev, &gpd_data->nb);
> +       dev_pm_qos_add_notifier(dev, &gpd_data->nb, DEV_PM_QOS_RESUME_LATENCY);
>
>         return ret;
>  }
> diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
> index 6c91f8df1d59..cfd463212513 100644
> --- a/drivers/base/power/qos.c
> +++ b/drivers/base/power/qos.c
> @@ -467,6 +467,7 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_request);
>   *
>   * @dev: target device for the constraint
>   * @notifier: notifier block managed by caller.
> + * @type: request type.
>   *
>   * Will register the notifier into a notification chain that gets called
>   * upon changes to the target value for the device.
> @@ -474,10 +475,14 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_request);
>   * If the device's constraints object doesn't exist when this routine is called,
>   * it will be created (or error code will be returned if that fails).
>   */
> -int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier)
> +int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier,
> +                           enum dev_pm_qos_req_type type)
>  {
>         int ret = 0;
>
> +       if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY))
> +               return -EINVAL;
> +
>         mutex_lock(&dev_pm_qos_mtx);
>
>         if (IS_ERR(dev->power.qos))
> @@ -500,15 +505,20 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_add_notifier);
>   *
>   * @dev: target device for the constraint
>   * @notifier: notifier block to be removed.
> + * @type: request type.
>   *
>   * Will remove the notifier from the notification chain that gets called
>   * upon changes to the target value.
>   */
>  int dev_pm_qos_remove_notifier(struct device *dev,
> -                              struct notifier_block *notifier)
> +                              struct notifier_block *notifier,
> +                              enum dev_pm_qos_req_type type)
>  {
>         int retval = 0;
>
> +       if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY))
> +               return -EINVAL;
> +
>         mutex_lock(&dev_pm_qos_mtx);
>
>         /* Silently return if the constraints object is not present. */
> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> index 6ea1ae373d77..1f4d456e8fff 100644
> --- a/include/linux/pm_qos.h
> +++ b/include/linux/pm_qos.h
> @@ -146,9 +146,11 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
>  int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
>  int dev_pm_qos_remove_request(struct dev_pm_qos_request *req);
>  int dev_pm_qos_add_notifier(struct device *dev,
> -                           struct notifier_block *notifier);
> +                           struct notifier_block *notifier,
> +                           enum dev_pm_qos_req_type type);
>  int dev_pm_qos_remove_notifier(struct device *dev,
> -                              struct notifier_block *notifier);
> +                              struct notifier_block *notifier,
> +                              enum dev_pm_qos_req_type type);
>  void dev_pm_qos_constraints_init(struct device *dev);
>  void dev_pm_qos_constraints_destroy(struct device *dev);
>  int dev_pm_qos_add_ancestor_request(struct device *dev,
> @@ -202,10 +204,12 @@ static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req,
>  static inline int dev_pm_qos_remove_request(struct dev_pm_qos_request *req)
>                         { return 0; }
>  static inline int dev_pm_qos_add_notifier(struct device *dev,
> -                                         struct notifier_block *notifier)
> +                                         struct notifier_block *notifier,
> +                                         enum dev_pm_qos_req_type type);
>                         { return 0; }
>  static inline int dev_pm_qos_remove_notifier(struct device *dev,
> -                                            struct notifier_block *notifier)
> +                                            struct notifier_block *notifier,
> +                                            enum dev_pm_qos_req_type type)
>                         { return 0; }
>  static inline void dev_pm_qos_constraints_init(struct device *dev)
>  {
> --
> 2.21.0.rc0.269.g1a574e7a288b
>

  parent reply	other threads:[~2019-06-17  9:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 10:51 [PATCH V3 0/5] cpufreq: Use QoS layer to manage freq-constraints Viresh Kumar
2019-06-10 10:51 ` [PATCH V3 1/5] PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier() Viresh Kumar
2019-06-11 23:45   ` Matthias Kaehlcke
2019-06-17  9:23   ` Ulf Hansson [this message]
2019-06-17 22:52   ` Rafael J. Wysocki
2019-06-10 10:51 ` [PATCH V3 2/5] PM / QOS: Pass request type to dev_pm_qos_read_value() Viresh Kumar
2019-06-12  0:08   ` Matthias Kaehlcke
2019-06-17  9:23   ` Ulf Hansson
2019-06-17 23:14   ` Rafael J. Wysocki
2019-06-10 10:51 ` [PATCH V3 3/5] PM / QoS: Add support for MIN/MAX frequency constraints Viresh Kumar
2019-06-13  0:04   ` Matthias Kaehlcke
2019-06-17  9:23   ` Ulf Hansson
2019-06-10 10:51 ` [PATCH V3 4/5] cpufreq: Register notifiers with the PM QoS framework Viresh Kumar
2019-06-14 16:46   ` Matthias Kaehlcke
2019-06-17  3:02     ` Viresh Kumar
2019-06-17  9:23   ` Ulf Hansson
2019-06-17 23:26   ` Rafael J. Wysocki
2019-06-18 11:25     ` Viresh Kumar
2019-06-18 22:23       ` Rafael J. Wysocki
2019-06-19  6:39         ` Viresh Kumar
2019-06-19  9:15           ` Rafael J. Wysocki
2019-06-17 23:37   ` Rafael J. Wysocki
2019-06-18 11:34     ` Viresh Kumar
2019-06-10 10:51 ` [PATCH V3 5/5] cpufreq: Add QoS requests for userspace constraints Viresh Kumar
2019-06-14 17:14   ` Matthias Kaehlcke
2019-06-17  3:07     ` Viresh Kumar
2019-06-17  9:23   ` Ulf Hansson

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=CAPDyKFqiwVbmbnOZzpT-yokwwWrRTYXgmBtuUsdawEd3D0ySqQ@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=Qais.Yousef@arm.com \
    --cc=juri.lelli@gmail.com \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.