2022-10-10 10:47:36

by Qibo Huang

[permalink] [raw]
Subject: [PATCH] thermal/of: Initialize the thermal governor for configuring thermal zones.

Configure the initial thermal governor of thermal zones on the device tree.
Since the kernel provides a variety of thermal governors,
to a certain extent,thermal governor is also a specific hardware property
of thermal zones.

Signed-off-by: Qibo Huang <[email protected]>
---
drivers/thermal/thermal_of.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index fd2fb84bf246..617b5ac030b4 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -404,6 +404,11 @@ static struct thermal_zone_params *thermal_of_parameters_init(struct device_node
if (!tzp)
return ERR_PTR(-ENOMEM);

+ if (!of_property_read_string(child, "thermal-governor",
+ &governor_name))
+ strscpy(tzp->governor_name, governor_name,
+ THERMAL_NAME_LENGTH);
+
tzp->no_hwmon = true;

if (!of_property_read_u32(np, "sustainable-power", &prop))
--
2.37.1


2022-10-10 16:57:48

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] thermal/of: Initialize the thermal governor for configuring thermal zones.

Hi Qibo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rafael-pm/thermal]
[also build test ERROR on linus/master next-20221010]
[cannot apply to v6.0]
[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/Qibo-Huang/thermal-of-Initialize-the-thermal-governor-for-configuring-thermal-zones/20221010-182004
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
config: powerpc-randconfig-r006-20221010
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/12bc487799000aec6ff68d4ba0e2bcfba9359730
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Qibo-Huang/thermal-of-Initialize-the-thermal-governor-for-configuring-thermal-zones/20221010-182004
git checkout 12bc487799000aec6ff68d4ba0e2bcfba9359730
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/thermal/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/thermal/thermal_of.c:407:31: error: use of undeclared identifier 'child'; did you mean 'while'?
if (!of_property_read_string(child, "thermal-governor",
^~~~~
while
>> drivers/thermal/thermal_of.c:407:31: error: expected expression
>> drivers/thermal/thermal_of.c:408:7: error: use of undeclared identifier 'governor_name'; did you mean 'kernfs_name'?
&governor_name))
^~~~~~~~~~~~~
kernfs_name
include/linux/kernfs.h:392:5: note: 'kernfs_name' declared here
int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
^
drivers/thermal/thermal_of.c:409:31: error: use of undeclared identifier 'governor_name'; did you mean 'kernfs_name'?
strscpy(tzp->governor_name, governor_name,
^~~~~~~~~~~~~
kernfs_name
include/linux/kernfs.h:392:5: note: 'kernfs_name' declared here
int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
^
4 errors generated.


vim +407 drivers/thermal/thermal_of.c

395
396 static struct thermal_zone_params *thermal_of_parameters_init(struct device_node *np)
397 {
398 struct thermal_zone_params *tzp;
399 int coef[2];
400 int ncoef = ARRAY_SIZE(coef);
401 int prop, ret;
402
403 tzp = kzalloc(sizeof(*tzp), GFP_KERNEL);
404 if (!tzp)
405 return ERR_PTR(-ENOMEM);
406
> 407 if (!of_property_read_string(child, "thermal-governor",
> 408 &governor_name))
409 strscpy(tzp->governor_name, governor_name,
410 THERMAL_NAME_LENGTH);
411
412 tzp->no_hwmon = true;
413
414 if (!of_property_read_u32(np, "sustainable-power", &prop))
415 tzp->sustainable_power = prop;
416
417 /*
418 * For now, the thermal framework supports only one sensor per
419 * thermal zone. Thus, we are considering only the first two
420 * values as slope and offset.
421 */
422 ret = of_property_read_u32_array(np, "coefficients", coef, ncoef);
423 if (ret) {
424 coef[0] = 1;
425 coef[1] = 0;
426 }
427
428 tzp->slope = coef[0];
429 tzp->offset = coef[1];
430
431 return tzp;
432 }
433

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (4.31 kB)
config (149.91 kB)
Download all attachments