From 06aee9d0577df6bb01473339bcc505820bddc802 Mon Sep 17 00:00:00 2001 From: Kyle Repinski Date: Wed, 4 Nov 2015 08:08:06 -0600 Subject: libsensors: Build with -Wall -Werror. --- libsensors/Android.mk | 1 + libsensors/ProximitySensor.cpp | 2 +- libsensors/SamsungSensorBase.cpp | 8 ++++---- libsensors/sensors.cpp | 41 ++++++++++++++++++++++------------------ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/libsensors/Android.mk b/libsensors/Android.mk index 5f15228..98d03b0 100644 --- a/libsensors/Android.mk +++ b/libsensors/Android.mk @@ -38,5 +38,6 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := libinvensense_hal.$(TARGET_BOOTLOADER_BOARD_NAME) liblog libcutils libutils libdl LOCAL_CLANG := true +LOCAL_CFLAGS += -Wall -Werror include $(BUILD_SHARED_LIBRARY) diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index 4e1ec9d..56efc8d 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -36,7 +36,7 @@ ProximitySensor::ProximitySensor() mPendingEvent.type = SENSOR_TYPE_PROXIMITY; } -int ProximitySensor::setDelay(int32_t handle, int64_t ns) +int ProximitySensor::setDelay(int32_t handle __unused, int64_t ns __unused) { return -1; } diff --git a/libsensors/SamsungSensorBase.cpp b/libsensors/SamsungSensorBase.cpp index 4a2ce80..49ba7e8 100644 --- a/libsensors/SamsungSensorBase.cpp +++ b/libsensors/SamsungSensorBase.cpp @@ -47,11 +47,11 @@ char *SamsungSensorBase::makeSysfsName(const char *input_name, return name; } -bool SamsungSensorBase::handleEvent(input_event const * event) { +bool SamsungSensorBase::handleEvent(input_event const * event __unused) { return true; } -int SamsungSensorBase::handleEnable(int en) { +int SamsungSensorBase::handleEnable(int en __unused) { return 0; } @@ -96,7 +96,7 @@ SamsungSensorBase::~SamsungSensorBase() { delete[] mInputSysfsPollDelay; } -int SamsungSensorBase::enable(int32_t handle, int en) +int SamsungSensorBase::enable(int32_t handle __unused, int en) { int err = 0; pthread_mutex_lock(&mLock); @@ -120,7 +120,7 @@ cleanup: return err; } -int SamsungSensorBase::setDelay(int32_t handle, int64_t ns) +int SamsungSensorBase::setDelay(int32_t handle __unused, int64_t ns) { int fd; int result = 0; diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index 0065653..db6f8af 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -111,30 +111,38 @@ static int open_sensors(const struct hw_module_t* module, const char* id, struct hw_device_t** device); -static int sensors__get_sensors_list(struct sensors_module_t* module, +static int sensors__get_sensors_list(struct sensors_module_t* module __unused, struct sensor_t const** list) { *list = sSensorList; return numSensors; } +static int sensors__set_operation_mode(unsigned int mode) +{ + if (mode == SENSOR_HAL_NORMAL_MODE) + return 0; + return -EINVAL; +} + static struct hw_module_methods_t sensors_module_methods = { - open: open_sensors + .open = open_sensors }; struct sensors_module_t HAL_MODULE_INFO_SYM = { - common: { - tag: HARDWARE_MODULE_TAG, - version_major: 1, - version_minor: 0, - id: SENSORS_HARDWARE_MODULE_ID, - name: "Samsung Sensor module", - author: "Samsung Electronic Company", - methods: &sensors_module_methods, - dso: 0, - reserved: {}, + .common = { + .tag = HARDWARE_MODULE_TAG, + .version_major = 1, + .version_minor = 0, + .id = SENSORS_HARDWARE_MODULE_ID, + .name = "Samsung Sensor module", + .author = "Samsung Electronic Company", + .methods = &sensors_module_methods, + .dso = 0, + .reserved = {}, }, - get_sensors_list: sensors__get_sensors_list, + .get_sensors_list = sensors__get_sensors_list, + .set_operation_mode = sensors__set_operation_mode, }; struct sensors_poll_context_t { @@ -323,8 +331,6 @@ int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count) // we still have some room, so try to see if we can get // some events immediately or just wait if we don't have // anything to return - int i; - do { n = poll(mPollFds, numFds, nbEvents ? 0 : polltime); } while (n < 0 && errno == EINTR); @@ -389,7 +395,8 @@ static int poll__poll(struct sensors_poll_device_t *dev, /*****************************************************************************/ /** Open a new instance of a sensor device using name */ -static int open_sensors(const struct hw_module_t* module, const char* id, +static int open_sensors(const struct hw_module_t* module, + const char* id __unused, struct hw_device_t** device) { FUNC_LOG; @@ -411,5 +418,3 @@ static int open_sensors(const struct hw_module_t* module, const char* id, return status; } - - -- cgit v1.1