thermald: fix 32-bit build error with musl v1.2.0

Recent musl upgrades to v1.2.0 causing below error:
Error log:
 ../git/src/thd_trip_point.cpp: In member function 'bool cthd_trip_point::thd_trip_point_check(int, unsigned int, int, bool*)':
| ../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=]
|   250 |      thd_log_info("Too early to act zone:%d index %d tm %ld\n",

musl 1.2.0 have new feature:
time_t is now 64-bit on all archs (not just 64-bit archs)

Commit id:
https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51

Release note link for musl 1.2.0:
https://git.musl-libc.org/cgit/musl/diff/

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
This commit is contained in:
Naveen Saini 2020-03-06 10:44:08 +08:00 committed by Anuj Mittal
parent bba67420e6
commit cc60e742db
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,51 @@
From 2145c92fb2ee6d1b03b9ea92e0f910e60b925d70 Mon Sep 17 00:00:00 2001
From: Naveen Saini <naveen.kumar.saini@intel.com>
Date: Thu, 5 Mar 2020 13:45:57 +0800
Subject: [PATCH] thd_trip_point: fix 32-bit build error with musl v1.2.0
Error log:
../git/src/thd_trip_point.cpp: In member function 'bool cthd_trip_point::thd_trip_point_check(int, unsigned int, int, bool*)':
| ../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=]
| 250 | thd_log_info("Too early to act zone:%d index %d tm %ld\n",
musl 1.2.0 have new feature:
time_t is now 64-bit on all archs (not just 64-bit archs)
Commit id:
https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51
Release note link for musl 1.2.0:
https://git.musl-libc.org/cgit/musl/diff/
Upstream-Status: Submitted [https://github.com/intel/thermal_daemon/pull/217]
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
src/thd_trip_point.cpp | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/thd_trip_point.cpp b/src/thd_trip_point.cpp
index 043be0c..2186ac2 100644
--- a/src/thd_trip_point.cpp
+++ b/src/thd_trip_point.cpp
@@ -242,15 +242,9 @@ bool cthd_trip_point::thd_trip_point_check(int id, unsigned int read_temp,
time_t tm;
time(&tm);
if ((tm - cdevs[i].last_op_time) < cdevs[i].sampling_priod) {
-#if defined __x86_64__ && defined __ILP32__
- thd_log_info("Too early to act zone:%d index %d tm %lld\n",
+ thd_log_info("Too early to act zone:%d index %d tm %jd\n",
zone_id, cdev->thd_cdev_get_index(),
- tm - cdevs[i].last_op_time);
-#else
- thd_log_info("Too early to act zone:%d index %d tm %ld\n",
- zone_id, cdev->thd_cdev_get_index(),
- tm - cdevs[i].last_op_time);
-#endif
+ (intmax_t)tm - cdevs[i].last_op_time);
break;
}
cdevs[i].last_op_time = tm;
--
2.17.1

View File

@ -14,6 +14,7 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848" LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848"
SRC_URI = "git://github.com/intel/thermal_daemon/ \ SRC_URI = "git://github.com/intel/thermal_daemon/ \
file://0001-thd_trip_point-fix-32-bit-build-error-with-musl-v1.2.patch \
" "
SRCREV = "7e23f7cc4611fd7289014c9805749ec75d59bae0" SRCREV = "7e23f7cc4611fd7289014c9805749ec75d59bae0"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"