From 2653fe444378da68ed8b35105f6d577d7bf06c87 Mon Sep 17 00:00:00 2001 From: Björn Esser Date: Jul 01 2017 08:58:03 +0000 Subject: Add upstreamed patch to silence compiler warnings --- diff --git a/thermald-1.6-android_fix_build_file.patch b/thermald-1.6-android_fix_build_file.patch new file mode 100644 index 0000000..fd06307 --- /dev/null +++ b/thermald-1.6-android_fix_build_file.patch @@ -0,0 +1,100 @@ +From 93e52afc389c98880b91d61cf47c0603f4654ccd Mon Sep 17 00:00:00 2001 +From: lambdadroid +Date: Tue, 6 Jun 2017 15:39:42 +0200 +Subject: [PATCH] Android: Fix build file + +Android.mk was missing several source files, causing compile +errors. Also removed some unneeded explicit include directories. +--- + Android.mk | 73 ++++++++++++++++++++++++++++---------------------------------- + 1 file changed, 33 insertions(+), 40 deletions(-) + +diff --git a/Android.mk b/Android.mk +index 8ef9cf3..1a40bda 100644 +--- a/Android.mk ++++ b/Android.mk +@@ -2,51 +2,44 @@ LOCAL_PATH:= $(call my-dir) + + include $(CLEAR_VARS) + +-thermald_src_path := ./src +-thermald_src_files := \ +- $(thermald_src_path)/android_main.cpp \ +- $(thermald_src_path)/thd_engine.cpp \ +- $(thermald_src_path)/thd_cdev.cpp \ +- $(thermald_src_path)/thd_cdev_therm_sys_fs.cpp \ +- $(thermald_src_path)/thd_engine_default.cpp \ +- $(thermald_src_path)/thd_sys_fs.cpp \ +- $(thermald_src_path)/thd_trip_point.cpp \ +- $(thermald_src_path)/thd_zone.cpp \ +- $(thermald_src_path)/thd_zone_surface.cpp \ +- $(thermald_src_path)/thd_zone_cpu.cpp \ +- $(thermald_src_path)/thd_zone_therm_sys_fs.cpp \ +- $(thermald_src_path)/thd_preference.cpp \ +- $(thermald_src_path)/thd_model.cpp \ +- $(thermald_src_path)/thd_parse.cpp \ +- $(thermald_src_path)/thd_sensor.cpp \ +- $(thermald_src_path)/thd_sensor_virtual.cpp \ +- $(thermald_src_path)/thd_kobj_uevent.cpp \ +- $(thermald_src_path)/thd_cdev_order_parser.cpp \ +- $(thermald_src_path)/thd_cdev_gen_sysfs.cpp \ +- $(thermald_src_path)/thd_pid.cpp \ +- $(thermald_src_path)/thd_zone_generic.cpp \ +- $(thermald_src_path)/thd_cdev_cpufreq.cpp \ +- $(thermald_src_path)/thd_cdev_rapl.cpp \ +- $(thermald_src_path)/thd_cdev_intel_pstate_driver.cpp \ +- $(thermald_src_path)/thd_msr.cpp \ +- $(thermald_src_path)/thd_rapl_interface.cpp \ +- $(thermald_src_path)/thd_cdev_msr_rapl.cpp \ +- $(thermald_src_path)/thd_rapl_power_meter.cpp \ +- $(thermald_src_path)/thd_trt_art_reader.cpp \ +- $(thermald_src_path)/thd_cdev_rapl_dram.cpp \ +- $(thermald_src_path)/thd_cpu_default_binding.cpp \ +- $(thermald_src_path)/thd_cdev_backlight.cpp ++LOCAL_SRC_FILES := \ ++ src/android_main.cpp \ ++ src/thd_engine.cpp \ ++ src/thd_cdev.cpp \ ++ src/thd_cdev_therm_sys_fs.cpp \ ++ src/thd_engine_default.cpp \ ++ src/thd_sys_fs.cpp \ ++ src/thd_trip_point.cpp \ ++ src/thd_zone.cpp \ ++ src/thd_zone_surface.cpp \ ++ src/thd_zone_cpu.cpp \ ++ src/thd_zone_therm_sys_fs.cpp \ ++ src/thd_zone_dynamic.cpp \ ++ src/thd_preference.cpp \ ++ src/thd_model.cpp \ ++ src/thd_parse.cpp \ ++ src/thd_sensor.cpp \ ++ src/thd_sensor_virtual.cpp \ ++ src/thd_kobj_uevent.cpp \ ++ src/thd_cdev_order_parser.cpp \ ++ src/thd_cdev_gen_sysfs.cpp \ ++ src/thd_pid.cpp \ ++ src/thd_zone_generic.cpp \ ++ src/thd_cdev_cpufreq.cpp \ ++ src/thd_cdev_rapl.cpp \ ++ src/thd_cdev_intel_pstate_driver.cpp \ ++ src/thd_rapl_power_meter.cpp \ ++ src/thd_trt_art_reader.cpp \ ++ src/thd_cdev_rapl_dram.cpp \ ++ src/thd_cpu_default_binding.cpp \ ++ src/thd_cdev_backlight.cpp + +-LOCAL_C_INCLUDES += $(LOCAL_PATH) $(thermald_src_path) \ +- external/icu4c/common \ +- external/libxml2/include \ +- system/core/include/ ++LOCAL_C_INCLUDES += external/libxml2/include + + LOCAL_MODULE_TAGS := optional +-LOCAL_CFLAGS := -DTDRUNDIR='"/data/thermal-daemon"' -DTDCONFDIR='"/system/etc/thermal-daemon"' ++LOCAL_CFLAGS := -DTDRUNDIR='"/data/thermal-daemon"' -DTDCONFDIR='"/system/etc/thermal-daemon"' -Wno-unused-parameter + LOCAL_STATIC_LIBRARIES := libxml2 + LOCAL_SHARED_LIBRARIES := liblog libcutils libdl libc++ libicuuc libicui18n libbinder libutils + LOCAL_PRELINK_MODULE := false +-LOCAL_SRC_FILES := $(thermald_src_files) + LOCAL_MODULE := thermal-daemon + include $(BUILD_EXECUTABLE) diff --git a/thermald-1.6-android_fix_compile_errors.patch b/thermald-1.6-android_fix_compile_errors.patch new file mode 100644 index 0000000..0e9ba3e --- /dev/null +++ b/thermald-1.6-android_fix_compile_errors.patch @@ -0,0 +1,78 @@ +From bcbb8ea8e6ced976d4359db9bc4c35a9d8f345ba Mon Sep 17 00:00:00 2001 +From: lambdadroid +Date: Tue, 6 Jun 2017 15:56:37 +0200 +Subject: [PATCH] Android: Fix compile errors + +Android doesn't have DBUS so all functionality related to it +must be disabled by checking if GLIB_SUPPORT is defined. + +Currently, the build also fails with the following error: +thd_trip_point.h:139:2: error: control may reach end of non-void function + +This is because the exception is excluded for Android, and nothing is +returned if an invalid index is given into the method. + +The easiest way to fix this is to exclude the method entirely for +Android. The method is only used from DBUS code so it doesn't +cause any problems if Android doesn't have it. +--- + src/thd_engine_default.cpp | 9 +++++++-- + src/thd_trip_point.h | 4 ++-- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/thd_engine_default.cpp b/src/thd_engine_default.cpp +index ef0b588..0d4c55c 100644 +--- a/src/thd_engine_default.cpp ++++ b/src/thd_engine_default.cpp +@@ -36,7 +36,10 @@ + #include "thd_cdev_rapl_dram.h" + #include "thd_sensor_virtual.h" + #include "thd_cdev_backlight.h" ++ ++#ifdef GLIB_SUPPORT + #include "thd_cdev_modem.h" ++#endif + + // Default CPU cooling devices, which are not part of thermal sysfs + // Since non trivial initialization is not supported, we init all fields even if they are not needed +@@ -502,7 +505,8 @@ int cthd_engine_default::add_replace_cdev(cooling_dev_t *config) { + } + if (!cdev_present) { + // create new +- if (config->type_string.compare("intel_modem") == 0) ++ if (config->type_string.compare("intel_modem") == 0) { ++#ifdef GLIB_SUPPORT + /* + * Add Modem as cdev + * intel_modem is a modem identifier across all intel platforms. +@@ -510,7 +514,8 @@ int cthd_engine_default::add_replace_cdev(cooling_dev_t *config) { + * are to be taken care in the cdev implementation. + */ + cdev = new cthd_cdev_modem(current_cdev_index, config->path_str); +- else ++#endif ++ } else + cdev = new cthd_gen_sysfs_cdev(current_cdev_index, config->path_str); + if (!cdev) + return THD_ERROR; +diff --git a/src/thd_trip_point.h b/src/thd_trip_point.h +index 746f82f..7981d58 100644 +--- a/src/thd_trip_point.h ++++ b/src/thd_trip_point.h +@@ -129,14 +129,14 @@ class cthd_trip_point { + return cdevs.size(); + } + ++#ifndef ANDROID + trip_pt_cdev_t &get_cdev_at_index(unsigned int index) { + if (index < cdevs.size()) + return cdevs[index]; +-#ifndef ANDROID + else + throw std::invalid_argument("index"); +-#endif + } ++#endif + + void trip_cdev_add(trip_pt_cdev_t trip_cdev) { + int index; diff --git a/thermald-1.6-distribution_integration_update_RPM_spec_for_1_6.patch b/thermald-1.6-distribution_integration_update_RPM_spec_for_1_6.patch new file mode 100644 index 0000000..dc308c9 --- /dev/null +++ b/thermald-1.6-distribution_integration_update_RPM_spec_for_1_6.patch @@ -0,0 +1,39 @@ +From 8e76666785f732aa2c70c626b242cffd566ea434 Mon Sep 17 00:00:00 2001 +From: James Ye +Date: Mon, 3 Apr 2017 12:33:15 +1000 +Subject: [PATCH] distribution_integration: update RPM .spec for 1.6 + +- fix inconsistent indents +--- + distribution_integration/thermal-daemon.spec | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/distribution_integration/thermal-daemon.spec b/distribution_integration/thermal-daemon.spec +index d452438..5d24563 100644 +--- a/distribution_integration/thermal-daemon.spec ++++ b/distribution_integration/thermal-daemon.spec +@@ -1,12 +1,12 @@ + Name: thermald +-Version: 1.5 +-Release: 4%{?dist} ++Version: 1.6 ++Release: 1%{?dist} + Summary: The "Linux Thermal Daemon" program from 01.org + + License: GPLv2+ + URL: https://github.com/01org/thermal_daemon + %global pkgname thermal_daemon +-Source0: https://github.com/01org/thermal_daemon/archive/v%{version}.tar.gz ++Source0: https://github.com/01org/thermal_daemon/archive/v%{version}.tar.gz + + BuildRequires: automake + BuildRequires: autoconf +@@ -57,6 +57,8 @@ make %{?_smp_mflags} + %exclude %{_sysconfdir}/init + + %changelog ++* Mon Apr 03 2017 James Ye 1.6-1 ++- Updated to thermal daemon 1.6 + * Tue Oct 25 2016 Michael P. Moran <> 1.5-4 + - Updated spec file for version 1.5.4 + * Tue Mar 29 2016 Alexey Slaykovsky 1.5-3 diff --git a/thermald-1.6-silence_compiler_warnings_and_enable_Werror.patch b/thermald-1.6-silence_compiler_warnings_and_enable_Werror.patch new file mode 100644 index 0000000..d023d19 --- /dev/null +++ b/thermald-1.6-silence_compiler_warnings_and_enable_Werror.patch @@ -0,0 +1,102 @@ +From 783525be485838dd5a2884c1b2f33c5cebdadd1a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 1 Jul 2017 10:14:14 +0200 +Subject: [PATCH 1/3] Fix warning: 'bool trip_sort' defined but not used + [-Wunused-function] + +--- + src/thd_trip_point.h | 4 ---- + src/thd_zone.cpp | 4 ++++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/thd_trip_point.h b/src/thd_trip_point.h +index 7981d58..cf24d15 100644 +--- a/src/thd_trip_point.h ++++ b/src/thd_trip_point.h +@@ -171,8 +171,4 @@ class cthd_trip_point { + } + } + }; +- +-static bool trip_sort(cthd_trip_point trip1, cthd_trip_point trip2) { +- return (trip1.get_trip_temp() < trip2.get_trip_temp()); +-} + #endif +diff --git a/src/thd_zone.cpp b/src/thd_zone.cpp +index 9f327fd..31dd3ea 100644 +--- a/src/thd_zone.cpp ++++ b/src/thd_zone.cpp +@@ -34,6 +34,10 @@ + #include "thd_zone.h" + #include "thd_engine.h" + ++static bool trip_sort(cthd_trip_point trip1, cthd_trip_point trip2) { ++ return (trip1.get_trip_temp() < trip2.get_trip_temp()); ++} ++ + cthd_zone::cthd_zone(int _index, std::string control_path, sensor_relate_t rel) : + index(_index), zone_sysfs(control_path.c_str()), zone_temp(0), zone_active( + false), zone_cdev_binded_status(false), type_str(), sensor_rel( + +From 6384069b9373d87dba64d12aab1a782c498eff67 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 1 Jul 2017 10:20:25 +0200 +Subject: [PATCH 2/3] Fix warning: unused variable 'enabled' + [-Wunused-variable] + +--- + src/thd_cdev_modem.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/thd_cdev_modem.cpp b/src/thd_cdev_modem.cpp +index a56e8e1..b466da5 100644 +--- a/src/thd_cdev_modem.cpp ++++ b/src/thd_cdev_modem.cpp +@@ -173,7 +173,6 @@ int cthd_cdev_modem::get_modem_property(DBusConnection* conn, + DBusMessageIter key, var; + + char *property_name; +- dbus_bool_t enabled; + + dbus_message_iter_recurse(&dict, &key); + + +From 9250e90645215001ba2171ef2770723c47e13d79 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sat, 1 Jul 2017 10:23:21 +0200 +Subject: [PATCH 3/3] Enable -Werror to keep code clean + +--- + Android.mk | 2 +- + Makefile.am | 5 +++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Android.mk b/Android.mk +index 1a40bda..8612682 100644 +--- a/Android.mk ++++ b/Android.mk +@@ -37,7 +37,7 @@ LOCAL_SRC_FILES := \ + LOCAL_C_INCLUDES += external/libxml2/include + + LOCAL_MODULE_TAGS := optional +-LOCAL_CFLAGS := -DTDRUNDIR='"/data/thermal-daemon"' -DTDCONFDIR='"/system/etc/thermal-daemon"' -Wno-unused-parameter ++LOCAL_CFLAGS := -DTDRUNDIR='"/data/thermal-daemon"' -DTDCONFDIR='"/system/etc/thermal-daemon"' -Wno-unused-parameter -Werror + LOCAL_STATIC_LIBRARIES := libxml2 + LOCAL_SHARED_LIBRARIES := liblog libcutils libdl libc++ libicuuc libicui18n libbinder libutils + LOCAL_PRELINK_MODULE := false +diff --git a/Makefile.am b/Makefile.am +index ee96893..e76c163 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -14,8 +14,9 @@ AM_CXXFLAGS = ${DBUS_CFLAGS}\ + -Wreorder \ + -Wsign-compare \ + -Wreturn-type \ +- -Wunused-but-set-variable\ +- -Wformat ++ -Wunused-but-set-variable \ ++ -Wformat \ ++ -Werror + + EXTRA_DIST=Makefile.glib \ + thermald.pc.in diff --git a/thermald.spec b/thermald.spec index 0ec7e06..cb1ff9c 100644 --- a/thermald.spec +++ b/thermald.spec @@ -8,7 +8,7 @@ Name: thermald Version: 1.6 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Thermal Management daemon License: GPLv2+ @@ -21,14 +21,18 @@ Patch1: %{url}/commit/6a2344b4a55acc0cba356d0f7c521c0cdb6632e0.patch#/%{name}-1 Patch2: %{url}/commit/2a00d1745161c6d11b927f025ff1f4bb44f61d15.patch#/%{name}-1.6-load_preference_from_xml_file.patch Patch3: %{url}/commit/37a25879239466f2d096fd1a58b2ac7bbc3958f5.patch#/%{name}-1.6-set_default_preference.patch Patch4: %{url}/commit/35bda2d052b8820cbfce6c1918e3866c6fa3fd76.patch#/%{name}-1.6-update_QCustomPlot_2_0_0_beta.patch -Patch5: %{url}/commit/e311dc88d3acac7eca593efea5d95507b02608da.patch#/%{name}-1.6-remove_duplicate_assignment_to_critical_temp.patch -Patch6: %{url}/commit/7ee77cce542b2ed0421133b01904d5ad0ecdab6f.patch#/%{name}-1.6-thd_parse_check_for_xmlNodeListGetString_NULL_returns.patch -Patch7: %{url}/commit/8f7d49be960dd19edaef452a89b541e4509caef7.patch#/%{name}-1.6-fix_typo_on_field_name_default_prefernce.patch -Patch8: %{url}/commit/18989faac5138213a99f63346e49f4279caad9fb.patch#/%{name}-1.6-dont_terminate_the_thermald_engine_if_thd_engine_is_null.patch -Patch9: %{url}/commit/90169f80a70efd4d5b6101e87666cd355dbd786f.patch#/%{name}-1.6-removed_compile_flags.patch -Patch10: %{url}/commit/9c5d8354dd8efff340a030c05f7beda03061cd0a.patch#/%{name}-1.6-fix_dbus_re-init_accessing_deleted_pointer.patch -Patch11: %{url}/commit/18d6ca75bbc504aaf9fe862dc1c10c3c65fbe7bd.patch#/%{name}-1.6-initialize_lowest_valid_index_to_prevent_SEGV.patch -Patch12: %{url}/commit/07d7077af1992d52733b0dcf18538690a87b877f.patch#/%{name}-1.6-update_README_to_start_service.patch +Patch5: %{url}/commit/8e76666785f732aa2c70c626b242cffd566ea434.patch#/%{name}-1.6-distribution_integration_update_RPM_spec_for_1_6.patch +Patch6: %{url}/commit/e311dc88d3acac7eca593efea5d95507b02608da.patch#/%{name}-1.6-remove_duplicate_assignment_to_critical_temp.patch +Patch7: %{url}/commit/7ee77cce542b2ed0421133b01904d5ad0ecdab6f.patch#/%{name}-1.6-thd_parse_check_for_xmlNodeListGetString_NULL_returns.patch +Patch8: %{url}/commit/8f7d49be960dd19edaef452a89b541e4509caef7.patch#/%{name}-1.6-fix_typo_on_field_name_default_prefernce.patch +Patch9: %{url}/commit/18989faac5138213a99f63346e49f4279caad9fb.patch#/%{name}-1.6-dont_terminate_the_thermald_engine_if_thd_engine_is_null.patch +Patch10: %{url}/commit/90169f80a70efd4d5b6101e87666cd355dbd786f.patch#/%{name}-1.6-removed_compile_flags.patch +Patch11: %{url}/commit/93e52afc389c98880b91d61cf47c0603f4654ccd.patch#/%{name}-1.6-android_fix_build_file.patch +Patch12: %{url}/commit/bcbb8ea8e6ced976d4359db9bc4c35a9d8f345ba.patch#/%{name}-1.6-android_fix_compile_errors.patch +Patch13: %{url}/commit/9c5d8354dd8efff340a030c05f7beda03061cd0a.patch#/%{name}-1.6-fix_dbus_re-init_accessing_deleted_pointer.patch +Patch14: %{url}/commit/18d6ca75bbc504aaf9fe862dc1c10c3c65fbe7bd.patch#/%{name}-1.6-initialize_lowest_valid_index_to_prevent_SEGV.patch +Patch15: %{url}/commit/07d7077af1992d52733b0dcf18538690a87b877f.patch#/%{name}-1.6-update_README_to_start_service.patch +Patch16: %{url}/pull/133.patch#/%{name}-1.6-silence_compiler_warnings_and_enable_Werror.patch # No cpuid.h on other arches. ExclusiveArch: %{ix86} x86_64 @@ -273,6 +277,9 @@ fi %changelog +* Sat Jul 01 2017 Björn Esser - 1.6-6 +- Add upstreamed patch to silence compiler warnings + * Sat Jul 01 2017 Björn Esser - 1.6-5 - Replace fix for rhbz#1464548 from upstream commit - Add upstream patch to fix README