|
|
2653fe4 |
From bcbb8ea8e6ced976d4359db9bc4c35a9d8f345ba Mon Sep 17 00:00:00 2001
|
|
|
2653fe4 |
From: lambdadroid <lambdadroid@gmail.com>
|
|
|
2653fe4 |
Date: Tue, 6 Jun 2017 15:56:37 +0200
|
|
|
2653fe4 |
Subject: [PATCH] Android: Fix compile errors
|
|
|
2653fe4 |
|
|
|
2653fe4 |
Android doesn't have DBUS so all functionality related to it
|
|
|
2653fe4 |
must be disabled by checking if GLIB_SUPPORT is defined.
|
|
|
2653fe4 |
|
|
|
2653fe4 |
Currently, the build also fails with the following error:
|
|
|
2653fe4 |
thd_trip_point.h:139:2: error: control may reach end of non-void function
|
|
|
2653fe4 |
|
|
|
2653fe4 |
This is because the exception is excluded for Android, and nothing is
|
|
|
2653fe4 |
returned if an invalid index is given into the method.
|
|
|
2653fe4 |
|
|
|
2653fe4 |
The easiest way to fix this is to exclude the method entirely for
|
|
|
2653fe4 |
Android. The method is only used from DBUS code so it doesn't
|
|
|
2653fe4 |
cause any problems if Android doesn't have it.
|
|
|
2653fe4 |
---
|
|
|
2653fe4 |
src/thd_engine_default.cpp | 9 +++++++--
|
|
|
2653fe4 |
src/thd_trip_point.h | 4 ++--
|
|
|
2653fe4 |
2 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
2653fe4 |
|
|
|
2653fe4 |
diff --git a/src/thd_engine_default.cpp b/src/thd_engine_default.cpp
|
|
|
2653fe4 |
index ef0b588..0d4c55c 100644
|
|
|
2653fe4 |
--- a/src/thd_engine_default.cpp
|
|
|
2653fe4 |
+++ b/src/thd_engine_default.cpp
|
|
|
2653fe4 |
@@ -36,7 +36,10 @@
|
|
|
2653fe4 |
#include "thd_cdev_rapl_dram.h"
|
|
|
2653fe4 |
#include "thd_sensor_virtual.h"
|
|
|
2653fe4 |
#include "thd_cdev_backlight.h"
|
|
|
2653fe4 |
+
|
|
|
2653fe4 |
+#ifdef GLIB_SUPPORT
|
|
|
2653fe4 |
#include "thd_cdev_modem.h"
|
|
|
2653fe4 |
+#endif
|
|
|
2653fe4 |
|
|
|
2653fe4 |
// Default CPU cooling devices, which are not part of thermal sysfs
|
|
|
2653fe4 |
// Since non trivial initialization is not supported, we init all fields even if they are not needed
|
|
|
2653fe4 |
@@ -502,7 +505,8 @@ int cthd_engine_default::add_replace_cdev(cooling_dev_t *config) {
|
|
|
2653fe4 |
}
|
|
|
2653fe4 |
if (!cdev_present) {
|
|
|
2653fe4 |
// create new
|
|
|
2653fe4 |
- if (config->type_string.compare("intel_modem") == 0)
|
|
|
2653fe4 |
+ if (config->type_string.compare("intel_modem") == 0) {
|
|
|
2653fe4 |
+#ifdef GLIB_SUPPORT
|
|
|
2653fe4 |
/*
|
|
|
2653fe4 |
* Add Modem as cdev
|
|
|
2653fe4 |
* intel_modem is a modem identifier across all intel platforms.
|
|
|
2653fe4 |
@@ -510,7 +514,8 @@ int cthd_engine_default::add_replace_cdev(cooling_dev_t *config) {
|
|
|
2653fe4 |
* are to be taken care in the cdev implementation.
|
|
|
2653fe4 |
*/
|
|
|
2653fe4 |
cdev = new cthd_cdev_modem(current_cdev_index, config->path_str);
|
|
|
2653fe4 |
- else
|
|
|
2653fe4 |
+#endif
|
|
|
2653fe4 |
+ } else
|
|
|
2653fe4 |
cdev = new cthd_gen_sysfs_cdev(current_cdev_index, config->path_str);
|
|
|
2653fe4 |
if (!cdev)
|
|
|
2653fe4 |
return THD_ERROR;
|
|
|
2653fe4 |
diff --git a/src/thd_trip_point.h b/src/thd_trip_point.h
|
|
|
2653fe4 |
index 746f82f..7981d58 100644
|
|
|
2653fe4 |
--- a/src/thd_trip_point.h
|
|
|
2653fe4 |
+++ b/src/thd_trip_point.h
|
|
|
2653fe4 |
@@ -129,14 +129,14 @@ class cthd_trip_point {
|
|
|
2653fe4 |
return cdevs.size();
|
|
|
2653fe4 |
}
|
|
|
2653fe4 |
|
|
|
2653fe4 |
+#ifndef ANDROID
|
|
|
2653fe4 |
trip_pt_cdev_t &get_cdev_at_index(unsigned int index) {
|
|
|
2653fe4 |
if (index < cdevs.size())
|
|
|
2653fe4 |
return cdevs[index];
|
|
|
2653fe4 |
-#ifndef ANDROID
|
|
|
2653fe4 |
else
|
|
|
2653fe4 |
throw std::invalid_argument("index");
|
|
|
2653fe4 |
-#endif
|
|
|
2653fe4 |
}
|
|
|
2653fe4 |
+#endif
|
|
|
2653fe4 |
|
|
|
2653fe4 |
void trip_cdev_add(trip_pt_cdev_t trip_cdev) {
|
|
|
2653fe4 |
int index;
|