1From 074575bf3640485ab6d43ae1efed3eff9cebae13 Mon Sep 17 00:00:00 2001 2From: Naveen Saini <naveen.kumar.saini@intel.com> 3Date: Thu, 5 Mar 2020 13:45:57 +0800 4Subject: [PATCH] thd_trip_point: fix 32-bit build error with musl v1.2.0 5 6Error log: 7 ../git/src/thd_trip_point.cpp: In member function 'bool cthd_trip_point::thd_trip_point_check(int, unsigned int, int, bool*)': 8| ../git/src/thd_trip_point.cpp:250:19: error: format '%ld' expects argument of type 'long int', but argument 6 has type 'time_t' {aka 'long long int'} [-Werror=format=] 9| 250 | thd_log_info("Too early to act zone:%d index %d tm %ld\n", 10 11musl 1.2.0 have new feature: 12time_t is now 64-bit on all archs (not just 64-bit archs) 13 14Commit id: 15https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51 16 17Release note link for musl 1.2.0: 18https://git.musl-libc.org/cgit/musl/diff/ 19 20use %jd and typecast with intmax_t which is maximum width integer type 21 22Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> 23[Upstream: https://github.com/intel/thermal_daemon/commit/a7136682b9e6ebdb53c3c8b472bcd5039d62dc78.patch] 24Signed-off-by: Peter Seiderer <ps.report@gmx.net> 25--- 26 src/thd_trip_point.cpp | 10 ++-------- 27 1 file changed, 2 insertions(+), 8 deletions(-) 28 29diff --git a/src/thd_trip_point.cpp b/src/thd_trip_point.cpp 30index 46f692d..6358c27 100644 31--- a/src/thd_trip_point.cpp 32+++ b/src/thd_trip_point.cpp 33@@ -242,15 +242,9 @@ bool cthd_trip_point::thd_trip_point_check(int id, unsigned int read_temp, 34 time_t tm; 35 time(&tm); 36 if ((tm - cdevs[i].last_op_time) < cdevs[i].sampling_priod) { 37-#if defined __x86_64__ && defined __ILP32__ 38- thd_log_info("Too early to act zone:%d index %d tm %lld\n", 39+ thd_log_info("Too early to act zone:%d index %d tm %jd\n", 40 zone_id, cdev->thd_cdev_get_index(), 41- tm - cdevs[i].last_op_time); 42-#else 43- thd_log_info("Too early to act zone:%d index %d tm %ld\n", 44- zone_id, cdev->thd_cdev_get_index(), 45- tm - cdevs[i].last_op_time); 46-#endif 47+ (intmax_t)tm - cdevs[i].last_op_time); 48 break; 49 } 50 cdevs[i].last_op_time = tm; 51-- 522.29.2 53 54