diff mbox series

[1/4] thermal/core: Rename passive_delay and polling_delay with units

Message ID 20201202120657.1969-1-daniel.lezcano@linaro.org (mailing list archive)
State Superseded
Delegated to: Zhang Rui
Headers show
Series [1/4] thermal/core: Rename passive_delay and polling_delay with units | expand

Commit Message

Daniel Lezcano Dec. 2, 2020, 12:06 p.m. UTC
Set the scene to directly store the delays under their jiffies
form. Add to the variable name the 'ms' suffix.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_core.c  | 10 +++++-----
 drivers/thermal/thermal_of.c    |  8 ++++----
 drivers/thermal/thermal_sysfs.c |  6 +++---
 include/linux/thermal.h         |  8 ++++----
 4 files changed, 16 insertions(+), 16 deletions(-)

Comments

kernel test robot Dec. 2, 2020, 3:18 p.m. UTC | #1
Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.10-rc6 next-20201201]
[cannot apply to thermal/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]

url:    https://github.com/0day-ci/linux/commits/Daniel-Lezcano/thermal-core-Rename-passive_delay-and-polling_delay-with-units/20201202-201150
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
config: i386-randconfig-a001-20201202 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ade78f158731d79d859533d4370cc2a1294be32e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-Lezcano/thermal-core-Rename-passive_delay-and-polling_delay-with-units/20201202-201150
        git checkout ade78f158731d79d859533d4370cc2a1294be32e
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/platform/x86/acerhdf.c: In function 'acerhdf_check_param':
>> drivers/platform/x86/acerhdf.c:339:12: error: 'struct thermal_zone_device' has no member named 'polling_delay'; did you mean 'polling_delay_ms'?
     339 |   thermal->polling_delay = interval*1000;
         |            ^~~~~~~~~~~~~
         |            polling_delay_ms

vim +339 drivers/platform/x86/acerhdf.c

e86435eb91b2bff Peter Feuerer 2009-06-21  322  
e86435eb91b2bff Peter Feuerer 2009-06-21  323  static void acerhdf_check_param(struct thermal_zone_device *thermal)
e86435eb91b2bff Peter Feuerer 2009-06-21  324  {
e86435eb91b2bff Peter Feuerer 2009-06-21  325  	if (fanon > ACERHDF_MAX_FANON) {
e86435eb91b2bff Peter Feuerer 2009-06-21  326  		pr_err("fanon temperature too high, set to %d\n",
e86435eb91b2bff Peter Feuerer 2009-06-21  327  		       ACERHDF_MAX_FANON);
e86435eb91b2bff Peter Feuerer 2009-06-21  328  		fanon = ACERHDF_MAX_FANON;
e86435eb91b2bff Peter Feuerer 2009-06-21  329  	}
e86435eb91b2bff Peter Feuerer 2009-06-21  330  
e86435eb91b2bff Peter Feuerer 2009-06-21  331  	if (kernelmode && prev_interval != interval) {
e86435eb91b2bff Peter Feuerer 2009-06-21  332  		if (interval > ACERHDF_MAX_INTERVAL) {
e86435eb91b2bff Peter Feuerer 2009-06-21  333  			pr_err("interval too high, set to %d\n",
e86435eb91b2bff Peter Feuerer 2009-06-21  334  			       ACERHDF_MAX_INTERVAL);
e86435eb91b2bff Peter Feuerer 2009-06-21  335  			interval = ACERHDF_MAX_INTERVAL;
e86435eb91b2bff Peter Feuerer 2009-06-21  336  		}
e86435eb91b2bff Peter Feuerer 2009-06-21  337  		if (verbose)
eecc5bbc612a8b0 Joe Perches   2011-11-29  338  			pr_notice("interval changed to: %d\n", interval);
e86435eb91b2bff Peter Feuerer 2009-06-21 @339  		thermal->polling_delay = interval*1000;
e86435eb91b2bff Peter Feuerer 2009-06-21  340  		prev_interval = interval;
e86435eb91b2bff Peter Feuerer 2009-06-21  341  	}
e86435eb91b2bff Peter Feuerer 2009-06-21  342  }
e86435eb91b2bff Peter Feuerer 2009-06-21  343  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Dec. 2, 2020, 4:14 p.m. UTC | #2
Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.10-rc6 next-20201201]
[cannot apply to thermal/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]

url:    https://github.com/0day-ci/linux/commits/Daniel-Lezcano/thermal-core-Rename-passive_delay-and-polling_delay-with-units/20201202-201150
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
config: nios2-randconfig-r021-20201202 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/ade78f158731d79d859533d4370cc2a1294be32e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-Lezcano/thermal-core-Rename-passive_delay-and-polling_delay-with-units/20201202-201150
        git checkout ade78f158731d79d859533d4370cc2a1294be32e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/thermal/thermal_of.c: In function 'thermal_of_build_thermal_zone':
>> drivers/thermal/thermal_of.c:868:6: error: 'struct __thermal_zone' has no member named 'passive_delay_ms'; did you mean 'passive_delay'?
     868 |  tz->passive_delay_ms = prop;
         |      ^~~~~~~~~~~~~~~~
         |      passive_delay
>> drivers/thermal/thermal_of.c:875:6: error: 'struct __thermal_zone' has no member named 'polling_delay_ms'; did you mean 'polling_delay'?
     875 |  tz->polling_delay_ms = prop;
         |      ^~~~~~~~~~~~~~~~
         |      polling_delay
   drivers/thermal/thermal_of.c: In function 'of_parse_thermal_zones':
   drivers/thermal/thermal_of.c:1088:15: error: 'struct __thermal_zone' has no member named 'passive_delay_ms'; did you mean 'passive_delay'?
    1088 |           tz->passive_delay_ms,
         |               ^~~~~~~~~~~~~~~~
         |               passive_delay
   drivers/thermal/thermal_of.c:1089:15: error: 'struct __thermal_zone' has no member named 'polling_delay_ms'; did you mean 'polling_delay'?
    1089 |           tz->polling_delay_ms);
         |               ^~~~~~~~~~~~~~~~
         |               polling_delay
--
   drivers/thermal/da9062-thermal.c: In function 'da9062_thermal_poll_on':
>> drivers/thermal/da9062-thermal.c:98:43: error: 'struct thermal_zone_device' has no member named 'passive_delay'; did you mean 'passive_delay_ms'?
      98 |   delay = msecs_to_jiffies(thermal->zone->passive_delay);
         |                                           ^~~~~~~~~~~~~
         |                                           passive_delay_ms
   In file included from include/linux/printk.h:409,
                    from include/linux/kernel.h:16,
                    from include/linux/interrupt.h:6,
                    from drivers/thermal/da9062-thermal.c:22:
   drivers/thermal/da9062-thermal.c: In function 'da9062_thermal_probe':
   drivers/thermal/da9062-thermal.c:248:18: error: 'struct thermal_zone_device' has no member named 'passive_delay'; did you mean 'passive_delay_ms'?
     248 |   thermal->zone->passive_delay);
         |                  ^~~~~~~~~~~~~
   include/linux/dynamic_debug.h:129:15: note: in definition of macro '__dynamic_func_call'
     129 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   drivers/thermal/da9062-thermal.c:246:2: note: in expansion of macro 'dev_dbg'
     246 |  dev_dbg(&pdev->dev,
         |  ^~~~~~~

vim +868 drivers/thermal/thermal_of.c

   831	
   832	/**
   833	 * thermal_of_build_thermal_zone - parse and fill one thermal zone data
   834	 * @np: DT node containing a thermal zone node
   835	 *
   836	 * This function parses a thermal zone type of node represented by
   837	 * @np parameter and fills the read data into a __thermal_zone data structure
   838	 * and return this pointer.
   839	 *
   840	 * TODO: Missing properties to parse: thermal-sensor-names
   841	 *
   842	 * Return: On success returns a valid struct __thermal_zone,
   843	 * otherwise, it returns a corresponding ERR_PTR(). Caller must
   844	 * check the return value with help of IS_ERR() helper.
   845	 */
   846	static struct __thermal_zone
   847	__init *thermal_of_build_thermal_zone(struct device_node *np)
   848	{
   849		struct device_node *child = NULL, *gchild;
   850		struct __thermal_zone *tz;
   851		int ret, i;
   852		u32 prop, coef[2];
   853	
   854		if (!np) {
   855			pr_err("no thermal zone np\n");
   856			return ERR_PTR(-EINVAL);
   857		}
   858	
   859		tz = kzalloc(sizeof(*tz), GFP_KERNEL);
   860		if (!tz)
   861			return ERR_PTR(-ENOMEM);
   862	
   863		ret = of_property_read_u32(np, "polling-delay-passive", &prop);
   864		if (ret < 0) {
   865			pr_err("%pOFn: missing polling-delay-passive property\n", np);
   866			goto free_tz;
   867		}
 > 868		tz->passive_delay_ms = prop;
   869	
   870		ret = of_property_read_u32(np, "polling-delay", &prop);
   871		if (ret < 0) {
   872			pr_err("%pOFn: missing polling-delay property\n", np);
   873			goto free_tz;
   874		}
 > 875		tz->polling_delay_ms = prop;
   876	
   877		/*
   878		 * REVIST: for now, the thermal framework supports only
   879		 * one sensor per thermal zone. Thus, we are considering
   880		 * only the first two values as slope and offset.
   881		 */
   882		ret = of_property_read_u32_array(np, "coefficients", coef, 2);
   883		if (ret == 0) {
   884			tz->slope = coef[0];
   885			tz->offset = coef[1];
   886		} else {
   887			tz->slope = 1;
   888			tz->offset = 0;
   889		}
   890	
   891		/* trips */
   892		child = of_get_child_by_name(np, "trips");
   893	
   894		/* No trips provided */
   895		if (!child)
   896			goto finish;
   897	
   898		tz->ntrips = of_get_child_count(child);
   899		if (tz->ntrips == 0) /* must have at least one child */
   900			goto finish;
   901	
   902		tz->trips = kcalloc(tz->ntrips, sizeof(*tz->trips), GFP_KERNEL);
   903		if (!tz->trips) {
   904			ret = -ENOMEM;
   905			goto free_tz;
   906		}
   907	
   908		i = 0;
   909		for_each_child_of_node(child, gchild) {
   910			ret = thermal_of_populate_trip(gchild, &tz->trips[i++]);
   911			if (ret)
   912				goto free_trips;
   913		}
   914	
   915		of_node_put(child);
   916	
   917		/* cooling-maps */
   918		child = of_get_child_by_name(np, "cooling-maps");
   919	
   920		/* cooling-maps not provided */
   921		if (!child)
   922			goto finish;
   923	
   924		tz->num_tbps = of_get_child_count(child);
   925		if (tz->num_tbps == 0)
   926			goto finish;
   927	
   928		tz->tbps = kcalloc(tz->num_tbps, sizeof(*tz->tbps), GFP_KERNEL);
   929		if (!tz->tbps) {
   930			ret = -ENOMEM;
   931			goto free_trips;
   932		}
   933	
   934		i = 0;
   935		for_each_child_of_node(child, gchild) {
   936			ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++],
   937							      tz->trips, tz->ntrips);
   938			if (ret)
   939				goto free_tbps;
   940		}
   941	
   942	finish:
   943		of_node_put(child);
   944	
   945		return tz;
   946	
   947	free_tbps:
   948		for (i = i - 1; i >= 0; i--) {
   949			struct __thermal_bind_params *tbp = tz->tbps + i;
   950			int j;
   951	
   952			for (j = 0; j < tbp->count; j++)
   953				of_node_put(tbp->tcbp[j].cooling_device);
   954	
   955			kfree(tbp->tcbp);
   956		}
   957	
   958		kfree(tz->tbps);
   959	free_trips:
   960		for (i = 0; i < tz->ntrips; i++)
   961			of_node_put(tz->trips[i].np);
   962		kfree(tz->trips);
   963		of_node_put(gchild);
   964	free_tz:
   965		kfree(tz);
   966		of_node_put(child);
   967	
   968		return ERR_PTR(ret);
   969	}
   970	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 90e38cc199f4..53f55ceca220 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -317,9 +317,9 @@  static void monitor_thermal_zone(struct thermal_zone_device *tz)
 	mutex_lock(&tz->lock);
 
 	if (!stop && tz->passive)
-		thermal_zone_device_set_polling(tz, tz->passive_delay);
-	else if (!stop && tz->polling_delay)
-		thermal_zone_device_set_polling(tz, tz->polling_delay);
+		thermal_zone_device_set_polling(tz, tz->passive_delay_ms);
+	else if (!stop && tz->polling_delay_ms)
+		thermal_zone_device_set_polling(tz, tz->polling_delay_ms);
 	else
 		thermal_zone_device_set_polling(tz, 0);
 
@@ -1340,8 +1340,8 @@  thermal_zone_device_register(const char *type, int trips, int mask,
 	tz->device.class = &thermal_class;
 	tz->devdata = devdata;
 	tz->trips = trips;
-	tz->passive_delay = passive_delay;
-	tz->polling_delay = polling_delay;
+	tz->passive_delay_ms = passive_delay;
+	tz->polling_delay_ms = polling_delay;
 
 	/* sys I/F */
 	/* Add nodes that are always present via .groups */
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 69ef12f852b7..ebec4a8a8b5a 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -865,14 +865,14 @@  __init *thermal_of_build_thermal_zone(struct device_node *np)
 		pr_err("%pOFn: missing polling-delay-passive property\n", np);
 		goto free_tz;
 	}
-	tz->passive_delay = prop;
+	tz->passive_delay_ms = prop;
 
 	ret = of_property_read_u32(np, "polling-delay", &prop);
 	if (ret < 0) {
 		pr_err("%pOFn: missing polling-delay property\n", np);
 		goto free_tz;
 	}
-	tz->polling_delay = prop;
+	tz->polling_delay_ms = prop;
 
 	/*
 	 * REVIST: for now, the thermal framework supports only
@@ -1085,8 +1085,8 @@  int __init of_parse_thermal_zones(void)
 		zone = thermal_zone_device_register(child->name, tz->ntrips,
 						    mask, tz,
 						    ops, tzp,
-						    tz->passive_delay,
-						    tz->polling_delay);
+						    tz->passive_delay_ms,
+						    tz->polling_delay_ms);
 		if (IS_ERR(zone)) {
 			pr_err("Failed to build %pOFn zone %ld\n", child,
 			       PTR_ERR(zone));
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 0866e949339b..f465462d8aa1 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -233,12 +233,12 @@  passive_store(struct device *dev, struct device_attribute *attr,
 		return -EINVAL;
 
 	if (state && !tz->forced_passive) {
-		if (!tz->passive_delay)
-			tz->passive_delay = 1000;
+		if (!tz->passive_delay_ms)
+			tz->passive_delay_ms = 1000;
 		thermal_zone_device_rebind_exception(tz, "Processor",
 						     sizeof("Processor"));
 	} else if (!state && tz->forced_passive) {
-		tz->passive_delay = 0;
+		tz->passive_delay_ms = 0;
 		thermal_zone_device_unbind_exception(tz, "Processor",
 						     sizeof("Processor"));
 	}
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index d07ea27e72a9..230d451bf335 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -116,9 +116,9 @@  struct thermal_cooling_device {
  * @devdata:	private pointer for device private data
  * @trips:	number of trip points the thermal zone supports
  * @trips_disabled;	bitmap for disabled trips
- * @passive_delay:	number of milliseconds to wait between polls when
+ * @passive_delay_ms:	number of milliseconds to wait between polls when
  *			performing passive cooling.
- * @polling_delay:	number of milliseconds to wait between polls when
+ * @polling_delay_ms:	number of milliseconds to wait between polls when
  *			checking whether trip points have been crossed (0 for
  *			interrupt driven systems)
  * @temperature:	current temperature.  This is only for core code,
@@ -159,8 +159,8 @@  struct thermal_zone_device {
 	void *devdata;
 	int trips;
 	unsigned long trips_disabled;	/* bitmap for disabled trips */
-	int passive_delay;
-	int polling_delay;
+	int passive_delay_ms;
+	int polling_delay_ms;
 	int temperature;
 	int last_temperature;
 	int emul_temperature;