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