linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Leonard Crestez <leonard.crestez@nxp.com>
Cc: "Viresh Kumar" <viresh.kumar@linaro.org>,
	"MyungJoo Ham" <myungjoo.ham@samsung.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Matthias Kaehlcke" <mka@chromium.org>,
	"Chanwoo Choi" <cw00.choi@samsung.com>,
	"Artur Świgoń" <a.swigon@partner.samsung.com>,
	linux-pm@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH 2/3] PM: QoS: Export _freq_qos_apply
Date: Wed, 13 Nov 2019 23:23:56 +0100	[thread overview]
Message-ID: <2045347.p7qcj6nqyX@kreacher> (raw)
In-Reply-To: <27d83f2bb2aaa4e69d480622727ba7f4497dbe2a.1572025364.git.leonard.crestez@nxp.com>

On Friday, October 25, 2019 8:00:48 PM CET Leonard Crestez wrote:
> This is exported only for dev_pm_qos to use in order to implement
> per-device freq constraints.
> 
> Export with a leading underscore because this is an implementation
> detail, it's not meant to be used by drivers making QoS requests.
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
>  include/linux/pm_qos.h |  2 ++
>  kernel/power/qos.c     | 11 ++++++-----
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> index 9105f47f5195..e90dae0b8de9 100644
> --- a/include/linux/pm_qos.h
> +++ b/include/linux/pm_qos.h
> @@ -291,10 +291,12 @@ s32 freq_qos_read_value(struct freq_constraints *qos,
>  int freq_qos_add_request(struct freq_constraints *qos,
>  			 struct freq_qos_request *req,
>  			 enum freq_qos_req_type type, s32 value);
>  int freq_qos_update_request(struct freq_qos_request *req, s32 new_value);
>  int freq_qos_remove_request(struct freq_qos_request *req);
> +int _freq_qos_apply(struct freq_qos_request *req,
> +		    enum pm_qos_req_action action, s32 value);
>  
>  int freq_qos_add_notifier(struct freq_constraints *qos,
>  			  enum freq_qos_req_type type,
>  			  struct notifier_block *notifier);
>  int freq_qos_remove_notifier(struct freq_constraints *qos,
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index 04e83fdfbe80..ea38ae86bd66 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -708,16 +708,16 @@ s32 freq_qos_read_value(struct freq_constraints *qos,
>  
>  	return ret;
>  }
>  
>  /**
> - * freq_qos_apply - Add/modify/remove frequency QoS request.
> + * _freq_qos_apply - Add/modify/remove frequency QoS request.
>   * @req: Constraint request to apply.
>   * @action: Action to perform (add/update/remove).
>   * @value: Value to assign to the QoS request.
>   */
> -static int freq_qos_apply(struct freq_qos_request *req,
> +int _freq_qos_apply(struct freq_qos_request *req,
>  			  enum pm_qos_req_action action, s32 value)
>  {
>  	int ret;
>  
>  	switch(req->type) {
> @@ -733,10 +733,11 @@ static int freq_qos_apply(struct freq_qos_request *req,
>  		ret = -EINVAL;
>  	}
>  
>  	return ret;
>  }
> +EXPORT_SYMBOL_GPL(_freq_qos_apply);

The devuce PM QoS code is not modular, so this is not necessary.

And so I wouldn't change the name of the function, just make it non-static
and add its header to pm_qos.h.

>  
>  /**
>   * freq_qos_add_request - Insert new frequency QoS request into a given list.
>   * @qos: Constraints to update.
>   * @req: Preallocated request object.
> @@ -763,11 +764,11 @@ int freq_qos_add_request(struct freq_constraints *qos,
>  		 "%s() called for active request\n", __func__))
>  		return -EINVAL;
>  
>  	req->qos = qos;
>  	req->type = type;
> -	ret = freq_qos_apply(req, PM_QOS_ADD_REQ, value);
> +	ret = _freq_qos_apply(req, PM_QOS_ADD_REQ, value);
>  	if (ret < 0) {
>  		req->qos = NULL;
>  		req->type = 0;
>  	}
>  
> @@ -796,11 +797,11 @@ int freq_qos_update_request(struct freq_qos_request *req, s32 new_value)
>  		return -EINVAL;
>  
>  	if (req->pnode.prio == new_value)
>  		return 0;
>  
> -	return freq_qos_apply(req, PM_QOS_UPDATE_REQ, new_value);
> +	return _freq_qos_apply(req, PM_QOS_UPDATE_REQ, new_value);
>  }
>  EXPORT_SYMBOL_GPL(freq_qos_update_request);
>  
>  /**
>   * freq_qos_remove_request - Remove frequency QoS request from its list.
> @@ -819,11 +820,11 @@ int freq_qos_remove_request(struct freq_qos_request *req)
>  
>  	if (WARN(!freq_qos_request_active(req),
>  		 "%s() called for unknown object\n", __func__))
>  		return -EINVAL;
>  
> -	return freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
> +	return _freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
>  }
>  EXPORT_SYMBOL_GPL(freq_qos_remove_request);
>  
>  /**
>   * freq_qos_add_notifier - Add frequency QoS change notifier.
> 





  reply	other threads:[~2019-11-13 22:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 18:00 [PATCH 0/3] PM: QoS: Restore DEV_PM_QOS_MIN/MAX_FREQUENCY Leonard Crestez
2019-10-25 18:00 ` [PATCH 1/3] PM: QoS: Reorder pm_qos/freq_qos/dev_pm_qos structs Leonard Crestez
2019-10-25 18:00 ` [PATCH 2/3] PM: QoS: Export _freq_qos_apply Leonard Crestez
2019-11-13 22:23   ` Rafael J. Wysocki [this message]
2019-11-14 15:37     ` Leonard Crestez
2019-10-25 18:00 ` [PATCH 3/3] PM: QoS: Restore DEV_PM_QOS_MIN/MAX_FREQUENCY Leonard Crestez
2019-11-11 19:40 ` [PATCH 0/3] " Leonard Crestez

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=2045347.p7qcj6nqyX@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=a.swigon@partner.samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=myungjoo.ham@samsung.com \
    --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 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).