diff mbox series

[v4,3/4] OPP: Add api to retrieve opps which is at most the provided level

Message ID 1692717141-32743-4-git-send-email-quic_krichai@quicinc.com
State New
Headers show
Series PCI: qcom: Add support for OPP | expand

Commit Message

Krishna chaitanya chundru Aug. 22, 2023, 3:12 p.m. UTC
Add dev_pm_opp_find_level_floor() for searching a lesser match or
operating on OPP in the order of decreasing level.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 drivers/opp/core.c     | 26 ++++++++++++++++++++++++++
 include/linux/pm_opp.h |  4 ++++
 2 files changed, 30 insertions(+)

Comments

kernel test robot Aug. 22, 2023, 9:33 p.m. UTC | #1
Hi Krishna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/for-linus]
[also build test WARNING on robh/for-next rafael-pm/linux-next linus/master v6.5-rc7 next-20230822]
[cannot apply to pci/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/dt-bindings-pci-qcom-Add-opp-table/20230822-232104
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git for-linus
patch link:    https://lore.kernel.org/r/1692717141-32743-4-git-send-email-quic_krichai%40quicinc.com
patch subject: [PATCH v4 3/4] OPP: Add api to retrieve opps which is at most the provided level
config: parisc-randconfig-r081-20230823 (https://download.01.org/0day-ci/archive/20230823/202308230526.RjJmRzFy-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230823/202308230526.RjJmRzFy-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308230526.RjJmRzFy-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/opp/core.c:756: warning: Function parameter or member 'level' not described in 'dev_pm_opp_find_level_floor'
>> drivers/opp/core.c:756: warning: Excess function parameter 'freq' description in 'dev_pm_opp_find_level_floor'
   drivers/opp/core.c:2025: warning: Function parameter or member 'opp_table' not described in '_opp_set_supported_hw'
   drivers/opp/core.c:2025: warning: Excess function parameter 'dev' description in '_opp_set_supported_hw'
   drivers/opp/core.c:2068: warning: Function parameter or member 'opp_table' not described in '_opp_set_prop_name'
   drivers/opp/core.c:2068: warning: Excess function parameter 'dev' description in '_opp_set_prop_name'
   drivers/opp/core.c:2109: warning: Function parameter or member 'opp_table' not described in '_opp_set_regulators'
   drivers/opp/core.c:2109: warning: Excess function parameter 'count' description in '_opp_set_regulators'
   drivers/opp/core.c:2213: warning: Function parameter or member 'opp_table' not described in '_opp_set_clknames'
   drivers/opp/core.c:2213: warning: Function parameter or member 'config_clks' not described in '_opp_set_clknames'
   drivers/opp/core.c:2311: warning: Function parameter or member 'opp_table' not described in '_opp_set_config_regulators_helper'
   drivers/opp/core.c:2375: warning: Function parameter or member 'opp_table' not described in '_opp_attach_genpd'
   drivers/opp/core.c:2602: warning: Function parameter or member 'token' not described in 'dev_pm_opp_clear_config'
   drivers/opp/core.c:2602: warning: Excess function parameter 'opp_table' description in 'dev_pm_opp_clear_config'


vim +756 drivers/opp/core.c

   734	
   735	
   736	/**
   737	 * dev_pm_opp_find_level_floor() - Search for a rounded floor freq
   738	 * @dev:	device for which we do this operation
   739	 * @freq:	Start level
   740	 *
   741	 * Search for the matching floor *available* OPP from a starting level
   742	 * for a device.
   743	 *
   744	 * Return: matching *opp and refreshes *level accordingly, else returns
   745	 * ERR_PTR in case of error and should be handled using IS_ERR. Error return
   746	 * values can be:
   747	 * EINVAL:	for bad pointer
   748	 * ERANGE:	no match found for search
   749	 * ENODEV:	if device not found in list of registered devices
   750	 *
   751	 * The callers are required to call dev_pm_opp_put() for the returned OPP after
   752	 * use.
   753	 */
   754	struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
   755						      unsigned long *level)
 > 756	{
   757		return _find_key_floor(dev, level, 0, true, _read_level, NULL);
   758	}
   759	EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);
   760
kernel test robot Aug. 22, 2023, 11:10 p.m. UTC | #2
Hi Krishna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/for-linus]
[also build test WARNING on robh/for-next rafael-pm/linux-next linus/master v6.5-rc7 next-20230822]
[cannot apply to pci/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/dt-bindings-pci-qcom-Add-opp-table/20230822-232104
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git for-linus
patch link:    https://lore.kernel.org/r/1692717141-32743-4-git-send-email-quic_krichai%40quicinc.com
patch subject: [PATCH v4 3/4] OPP: Add api to retrieve opps which is at most the provided level
config: x86_64-randconfig-073-20230823 (https://download.01.org/0day-ci/archive/20230823/202308230637.gz3wmjrT-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230823/202308230637.gz3wmjrT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308230637.gz3wmjrT-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/opp/core.c:756: warning: Function parameter or member 'level' not described in 'dev_pm_opp_find_level_floor'
>> drivers/opp/core.c:756: warning: Excess function parameter 'freq' description in 'dev_pm_opp_find_level_floor'
   drivers/opp/core.c:2025: warning: Function parameter or member 'opp_table' not described in '_opp_set_supported_hw'
   drivers/opp/core.c:2025: warning: Excess function parameter 'dev' description in '_opp_set_supported_hw'
   drivers/opp/core.c:2068: warning: Function parameter or member 'opp_table' not described in '_opp_set_prop_name'
   drivers/opp/core.c:2068: warning: Excess function parameter 'dev' description in '_opp_set_prop_name'
   drivers/opp/core.c:2109: warning: Function parameter or member 'opp_table' not described in '_opp_set_regulators'
   drivers/opp/core.c:2109: warning: Excess function parameter 'count' description in '_opp_set_regulators'
   drivers/opp/core.c:2213: warning: Function parameter or member 'opp_table' not described in '_opp_set_clknames'
   drivers/opp/core.c:2213: warning: Function parameter or member 'config_clks' not described in '_opp_set_clknames'
   drivers/opp/core.c:2311: warning: Function parameter or member 'opp_table' not described in '_opp_set_config_regulators_helper'
   drivers/opp/core.c:2375: warning: Function parameter or member 'opp_table' not described in '_opp_attach_genpd'
   drivers/opp/core.c:2602: warning: Function parameter or member 'token' not described in 'dev_pm_opp_clear_config'
   drivers/opp/core.c:2602: warning: Excess function parameter 'opp_table' description in 'dev_pm_opp_clear_config'


vim +756 drivers/opp/core.c

   734	
   735	
   736	/**
   737	 * dev_pm_opp_find_level_floor() - Search for a rounded floor freq
   738	 * @dev:	device for which we do this operation
   739	 * @freq:	Start level
   740	 *
   741	 * Search for the matching floor *available* OPP from a starting level
   742	 * for a device.
   743	 *
   744	 * Return: matching *opp and refreshes *level accordingly, else returns
   745	 * ERR_PTR in case of error and should be handled using IS_ERR. Error return
   746	 * values can be:
   747	 * EINVAL:	for bad pointer
   748	 * ERANGE:	no match found for search
   749	 * ENODEV:	if device not found in list of registered devices
   750	 *
   751	 * The callers are required to call dev_pm_opp_put() for the returned OPP after
   752	 * use.
   753	 */
   754	struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
   755						      unsigned long *level)
 > 756	{
   757		return _find_key_floor(dev, level, 0, true, _read_level, NULL);
   758	}
   759	EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);
   760
Pavan Kondeti Aug. 23, 2023, 1:05 a.m. UTC | #3
On Tue, Aug 22, 2023 at 08:42:20PM +0530, Krishna chaitanya chundru wrote:
> Add dev_pm_opp_find_level_floor() for searching a lesser match or
> operating on OPP in the order of decreasing level.
> 

"OPP: Add api to retrieve opps which is at most the provided level". Pls
change this to "opp: Add dev_pm_opp_find_level_floor()". The API name
conveys the message.

In the description, you can give a use case. i.e voting for the max
level during initialization of a driver.


> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>  drivers/opp/core.c     | 26 ++++++++++++++++++++++++++
>  include/linux/pm_opp.h |  4 ++++
>  2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 954c948..e668cf2 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -727,6 +727,32 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
>  }
>  EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil);
>  
> +
> +/**
> + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq
> + * @dev:	device for which we do this operation
> + * @freq:	Start level
> + *

%s/freq/level

Run make W=1 so that kerneldoc is tested.

> + * Search for the matching floor *available* OPP from a starting level
> + * for a device.
> + *
> + * Return: matching *opp and refreshes *level accordingly, else returns
> + * ERR_PTR in case of error and should be handled using IS_ERR. Error return
> + * values can be:

What do you mean by refresh here?

> + * EINVAL:	for bad pointer
> + * ERANGE:	no match found for search
> + * ENODEV:	if device not found in list of registered devices
> + *
> + * The callers are required to call dev_pm_opp_put() for the returned OPP after
> + * use.
> + */
> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
> +					      unsigned long *level)
> +{
> +	return _find_key_floor(dev, level, 0, true, _read_level, NULL);
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);
> +
>  /**
>   * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth
>   * @dev:	device for which we do this operation
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index dc1fb58..a3bc386 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -128,6 +128,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
>  					       unsigned int level);
>  struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
>  					      unsigned int *level);
> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
> +					      unsigned long *level);
>  
>  struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
>  					     unsigned long *freq);
> @@ -285,6 +287,8 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev,
>  
>  static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev,
>  					unsigned int *bw, int index)
> +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
> +					unsigned long *level)
>  {
>  	return ERR_PTR(-EOPNOTSUPP);
>  }
> 
Please run ./scripts/checkpatch.pl --strict <your patch> and fix the
indentation warnings from this patch.

Thanks,
Pavan
Krishna chaitanya chundru Sept. 7, 2023, 6:04 a.m. UTC | #4
On 8/23/2023 6:35 AM, Pavan Kondeti wrote:
> On Tue, Aug 22, 2023 at 08:42:20PM +0530, Krishna chaitanya chundru wrote:
>> Add dev_pm_opp_find_level_floor() for searching a lesser match or
>> operating on OPP in the order of decreasing level.
>>
> "OPP: Add api to retrieve opps which is at most the provided level". Pls
> change this to "opp: Add dev_pm_opp_find_level_floor()". The API name
> conveys the message.
>
> In the description, you can give a use case. i.e voting for the max
> level during initialization of a driver.
>
Done
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   drivers/opp/core.c     | 26 ++++++++++++++++++++++++++
>>   include/linux/pm_opp.h |  4 ++++
>>   2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
>> index 954c948..e668cf2 100644
>> --- a/drivers/opp/core.c
>> +++ b/drivers/opp/core.c
>> @@ -727,6 +727,32 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
>>   }
>>   EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil);
>>   
>> +
>> +/**
>> + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq
>> + * @dev:	device for which we do this operation
>> + * @freq:	Start level
>> + *
> %s/freq/level
>
> Run make W=1 so that kerneldoc is tested.
Done
>> + * Search for the matching floor *available* OPP from a starting level
>> + * for a device.
>> + *
>> + * Return: matching *opp and refreshes *level accordingly, else returns
>> + * ERR_PTR in case of error and should be handled using IS_ERR. Error return
>> + * values can be:
> What do you mean by refresh here?

LevelĀ  argument will be updated by this API with the opp level being 
returned here,

I was trying to use same terminology used in other API's

>> + * EINVAL:	for bad pointer
>> + * ERANGE:	no match found for search
>> + * ENODEV:	if device not found in list of registered devices
>> + *
>> + * The callers are required to call dev_pm_opp_put() for the returned OPP after
>> + * use.
>> + */
>> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
>> +					      unsigned long *level)
>> +{
>> +	return _find_key_floor(dev, level, 0, true, _read_level, NULL);
>> +}
>> +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);
>> +
>>   /**
>>    * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth
>>    * @dev:	device for which we do this operation
>> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
>> index dc1fb58..a3bc386 100644
>> --- a/include/linux/pm_opp.h
>> +++ b/include/linux/pm_opp.h
>> @@ -128,6 +128,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
>>   					       unsigned int level);
>>   struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
>>   					      unsigned int *level);
>> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
>> +					      unsigned long *level);
>>   
>>   struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
>>   					     unsigned long *freq);
>> @@ -285,6 +287,8 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev,
>>   
>>   static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev,
>>   					unsigned int *bw, int index)
>> +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
>> +					unsigned long *level)
>>   {
>>   	return ERR_PTR(-EOPNOTSUPP);
>>   }
>>
> Please run ./scripts/checkpatch.pl --strict <your patch> and fix the
> indentation warnings from this patch.
>
> Thanks,
> Pavan

Done

- KC
diff mbox series

Patch

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 954c948..e668cf2 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -727,6 +727,32 @@  struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil);
 
+
+/**
+ * dev_pm_opp_find_level_floor() - Search for a rounded floor freq
+ * @dev:	device for which we do this operation
+ * @freq:	Start level
+ *
+ * Search for the matching floor *available* OPP from a starting level
+ * for a device.
+ *
+ * Return: matching *opp and refreshes *level accordingly, else returns
+ * ERR_PTR in case of error and should be handled using IS_ERR. Error return
+ * values can be:
+ * EINVAL:	for bad pointer
+ * ERANGE:	no match found for search
+ * ENODEV:	if device not found in list of registered devices
+ *
+ * The callers are required to call dev_pm_opp_put() for the returned OPP after
+ * use.
+ */
+struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
+					      unsigned long *level)
+{
+	return _find_key_floor(dev, level, 0, true, _read_level, NULL);
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);
+
 /**
  * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth
  * @dev:	device for which we do this operation
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index dc1fb58..a3bc386 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -128,6 +128,8 @@  struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
 					       unsigned int level);
 struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
 					      unsigned int *level);
+struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
+					      unsigned long *level);
 
 struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
 					     unsigned long *freq);
@@ -285,6 +287,8 @@  static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev,
 
 static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev,
 					unsigned int *bw, int index)
+static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
+					unsigned long *level)
 {
 	return ERR_PTR(-EOPNOTSUPP);
 }