OSDN Git Service

Sensors: MultiHal: fix naming and compiler warning
authorNick Vaccaro <nvaccaro@terrapin.mtv.corp.google.com>
Fri, 15 Apr 2016 17:17:07 +0000 (10:17 -0700)
committerNick Vaccaro <nvaccaro@google.com>
Mon, 18 Apr 2016 23:37:34 +0000 (16:37 -0700)
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
modules/sensors/multihal.cpp

index bf377c9..534e6e9 100644 (file)
@@ -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
 
index e0dbce2..0edbc2d 100644 (file)
@@ -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,