0001-thd_trip_point-fix-32-bit-build-error-with-musl-v1.2.patch 2.1 KB

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