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
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 @@
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 @@
// 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 @@
// 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 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,