From a889c0915af205d7af1a8032e54b5a4d4496babb Mon Sep 17 00:00:00 2001 From: Nick Vaccaro Date: Fri, 15 Apr 2016 10:17:07 -0700 Subject: [PATCH] Sensors: MultiHal: fix naming and compiler warning Changed module name back to sensors.$(TARGET_DEVICE) to assure proper load ordering. Fix use of GNU old-style field designator extension and a couple type-mismatched comparisons. Bug: 28251347 Change-Id: I7cf6cc1f78085b8b254729cd8ec42bdb20ea3f81 --- modules/sensors/Android.mk | 2 +- modules/sensors/multihal.cpp | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk index bf377c9..534e6e9 100644 --- a/modules/sensors/Android.mk +++ b/modules/sensors/Android.mk @@ -20,7 +20,7 @@ ifeq ($(USE_SENSOR_MULTI_HAL),true) include $(CLEAR_VARS) -LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM) +LOCAL_MODULE := sensors.$(TARGET_DEVICE) LOCAL_MODULE_RELATIVE_PATH := hw diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp index e0dbce2..0edbc2d 100644 --- a/modules/sensors/multihal.cpp +++ b/modules/sensors/multihal.cpp @@ -228,7 +228,7 @@ void sensors_poll_context_t::addSubHwDevice(struct hw_device_t* sub_hw_device) { // Returns the device pointer, or NULL if the global handle is invalid. sensors_poll_device_t* sensors_poll_context_t::get_v0_device_by_handle(int global_handle) { int sub_index = get_module_index(global_handle); - if (sub_index < 0 || sub_index >= this->sub_hw_devices.size()) { + if (sub_index < 0 || sub_index >= (int) this->sub_hw_devices.size()) { return NULL; } return (sensors_poll_device_t*) this->sub_hw_devices[sub_index]; @@ -237,7 +237,7 @@ sensors_poll_device_t* sensors_poll_context_t::get_v0_device_by_handle(int globa // Returns the device pointer, or NULL if the global handle is invalid. sensors_poll_device_1_t* sensors_poll_context_t::get_v1_device_by_handle(int global_handle) { int sub_index = get_module_index(global_handle); - if (sub_index < 0 || sub_index >= this->sub_hw_devices.size()) { + if (sub_index < 0 || sub_index >= (int) this->sub_hw_devices.size()) { return NULL; } return (sensors_poll_device_1_t*) this->sub_hw_devices[sub_index]; @@ -605,22 +605,22 @@ static int module__get_sensors_list(__unused struct sensors_module_t* module, } 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 : 1, - id : SENSORS_HARDWARE_MODULE_ID, - name : "MultiHal Sensor Module", - author : "Google, Inc", - methods : &sensors_module_methods, - dso : NULL, - reserved : {0}, + .common = { + .tag = HARDWARE_MODULE_TAG, + .version_major = 1, + .version_minor = 1, + .id = SENSORS_HARDWARE_MODULE_ID, + .name = "MultiHal Sensor Module", + .author = "Google, Inc", + .methods = &sensors_module_methods, + .dso = NULL, + .reserved = {0}, }, - get_sensors_list : module__get_sensors_list + .get_sensors_list = module__get_sensors_list }; static int open_sensors(const struct hw_module_t* hw_module, const char* name, -- 2.11.0