diff mbox series

[v1,2/9] thermal: thermal: Export OF trip helper function

Message ID 20220615094804.388280-3-francesco.dolcini@toradex.com (mailing list archive)
State New, archived
Headers show
Series imx: thermal: Allow trip point configuration from DT | expand

Commit Message

Francesco Dolcini June 15, 2022, 9:47 a.m. UTC
Export function that populate thermal trip struct from a of node to be
able to re-use it in thermal drivers different from thermal_of.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 drivers/thermal/thermal_core.h | 7 +++++++
 drivers/thermal/thermal_of.c   | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

kernel test robot June 15, 2022, 7:24 p.m. UTC | #1
Hi Francesco,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on rafael-pm/thermal krzk/for-next krzk-mem-ctrl/for-next v5.19-rc2 next-20220615]
[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/intel-lab-lkp/linux/commits/Francesco-Dolcini/imx-thermal-Allow-trip-point-configuration-from-DT/20220615-175857
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20220616/202206160331.en1dbvYm-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/e68c5a0d2b91a47a9df63a6309c0ed9e905fc20a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Francesco-Dolcini/imx-thermal-Allow-trip-point-configuration-from-DT/20220615-175857
        git checkout e68c5a0d2b91a47a9df63a6309c0ed9e905fc20a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/

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

All errors (new ones prefixed by >>):

   In file included from drivers/thermal/thermal_core.c:27:
   drivers/thermal/thermal_core.h: In function 'thermal_of_populate_trip':
>> drivers/thermal/thermal_core.h:179:17: error: 'ENOTSUP' undeclared (first use in this function); did you mean 'ENOTSUPP'?
     179 |         return -ENOTSUP;
         |                 ^~~~~~~
         |                 ENOTSUPP
   drivers/thermal/thermal_core.h:179:17: note: each undeclared identifier is reported only once for each function it appears in


vim +179 drivers/thermal/thermal_core.h

   150	
   151	/* device tree support */
   152	#ifdef CONFIG_THERMAL_OF
   153	int of_parse_thermal_zones(void);
   154	int of_thermal_get_ntrips(struct thermal_zone_device *);
   155	bool of_thermal_is_trip_valid(struct thermal_zone_device *, int);
   156	const struct thermal_trip *
   157	of_thermal_get_trip_points(struct thermal_zone_device *);
   158	int thermal_of_populate_trip(struct device_node *np,
   159				     struct thermal_trip *trip);
   160	#else
   161	static inline int of_parse_thermal_zones(void) { return 0; }
   162	static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
   163	{
   164		return 0;
   165	}
   166	static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,
   167						    int trip)
   168	{
   169		return false;
   170	}
   171	static inline const struct thermal_trip *
   172	of_thermal_get_trip_points(struct thermal_zone_device *tz)
   173	{
   174		return NULL;
   175	}
   176	static inline int thermal_of_populate_trip(struct device_node *np,
   177						   struct thermal_trip *trip)
   178	{
 > 179		return -ENOTSUP;
   180	}
   181	#endif
   182
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 726e327b4205..81e6d041e79c 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -155,6 +155,8 @@  int of_thermal_get_ntrips(struct thermal_zone_device *);
 bool of_thermal_is_trip_valid(struct thermal_zone_device *, int);
 const struct thermal_trip *
 of_thermal_get_trip_points(struct thermal_zone_device *);
+int thermal_of_populate_trip(struct device_node *np,
+			     struct thermal_trip *trip);
 #else
 static inline int of_parse_thermal_zones(void) { return 0; }
 static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
@@ -171,6 +173,11 @@  of_thermal_get_trip_points(struct thermal_zone_device *tz)
 {
 	return NULL;
 }
+static inline int thermal_of_populate_trip(struct device_node *np,
+					   struct thermal_trip *trip)
+{
+	return -ENOTSUP;
+}
 #endif
 
 int thermal_zone_device_is_enabled(struct thermal_zone_device *tz);
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index b65d435cb92f..dcd6571a3871 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -817,8 +817,8 @@  static int thermal_of_get_trip_type(struct device_node *np,
  *
  * Return: 0 on success, proper error code otherwise
  */
-static int thermal_of_populate_trip(struct device_node *np,
-				    struct thermal_trip *trip)
+int thermal_of_populate_trip(struct device_node *np,
+			     struct thermal_trip *trip)
 {
 	int prop;
 	int ret;
@@ -849,6 +849,7 @@  static int thermal_of_populate_trip(struct device_node *np,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(thermal_of_populate_trip);
 
 /**
  * thermal_of_build_thermal_zone - parse and fill one thermal zone data