OSDN Git Service

Winter cleanup: comment harmonization, space shuffling, etc.
authorPatrick Porlan <patrick.porlan@intel.com>
Mon, 15 Dec 2014 09:31:39 +0000 (10:31 +0100)
committerGerrit Code Review <gerrit2@irsgerrit001.ir.intel.com>
Tue, 16 Dec 2014 11:30:05 +0000 (11:30 +0000)
Let's be consistent throughtout the code, unless there's a reason
to do thing differently.

Change-Id: I8aef25020b272d9e1e0210652758c0ce3d4d560c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
common.h
compass-calibration.c
control.c
description.c
filtering.c
transform.c

index 2889c6e..3a2da16 100644 (file)
--- a/common.h
+++ b/common.h
@@ -133,7 +133,7 @@ struct sensor_info_t
        const char* selected_trigger;
 
        float offset;   /* (cooked = raw + offset) * scale */
-       float scale;    /*default: 1. when set to 0, use channel specific value*/
+       float scale;    /*default:1. when set to 0, use channel specific value*/
        float illumincalib;     /* to set the calibration for the ALS */
 
        float requested_rate;   /* requested events / second */
@@ -183,13 +183,18 @@ struct sensor_info_t
        /* Whether or not the above buffer contains data from a device report */
        int report_initialized;
 
+       /* Channel and sample finalization callbacks for this sensor */
        struct sample_ops_t ops;
 
        int cal_level; /* 0 means not calibrated */
 
-       /* Depending on the sensor calibration may take too much at higher levels */
+       /*
+        * Depending on the sensor, calibration may take too much time at
+        * higher levels. Allow optional capping to a certain level.
+        */
        int max_cal_level;
-       void* cal_data;
+
+       void *cal_data; /* Sensor calibration data, e.g. for magnetometer */
 
        /* Filtering data for noisy sensors */
        void* filter;
index 5754858..2a2d5dc 100644 (file)
@@ -484,10 +484,10 @@ static int compass_ready (struct sensor_info_t* info)
     struct compass_cal* cal_data = (struct compass_cal*) info->cal_data;
 
     /*
-    *  Some sensors take unrealistically long to calibrate at higher levels.
-    *  We'll use a max_cal_level if we have such a property setup, or go with
-    *  the default settings if not.
-    */
+     *  Some sensors take unrealistically long to calibrate at higher levels.
+     *  We'll use a max_cal_level if we have such a property setup, or go with
+     *  the default settings if not.
+     */
     int cal_steps = (info->max_cal_level && info->max_cal_level <= CAL_STEPS) ?
         info->max_cal_level : CAL_STEPS;
 
index 12d118b..bf9bd4f 100644 (file)
--- a/control.c
+++ b/control.c
@@ -465,7 +465,7 @@ static int get_field_count (int s)
                        return 1;
 
                case SENSOR_TYPE_ROTATION_VECTOR:
-                       return  4;
+                       return 4;
 
                default:
                        ALOGE("Unknown sensor type!\n");
index 136ff98..08d4148 100644 (file)
@@ -206,8 +206,7 @@ int sensor_get_version (__attribute__((unused)) int s)
 
 float sensor_get_max_range (int s)
 {
-
-       if (sensor[s].is_virtual)  {
+       if (sensor[s].is_virtual) {
                switch (sensor[s].type) {
                        case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
                        case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
@@ -250,7 +249,7 @@ float sensor_get_max_range (int s)
                        return 100;
 
                default:
-                       return 0.0;
+                       return 0;
                }
 }
 
@@ -381,7 +380,7 @@ int sensor_get_order (int s, unsigned char map[MAX_CHANNELS])
        int i;
        int count = sensor_catalog[sensor[s].catalog_index].num_channels;
 
-       if  (sensor_get_st_prop(s, "order", buf))
+       if (sensor_get_st_prop(s, "order", buf))
                return 0; /* No order property */
 
        /* Assume ASCII characters, in the '0'..'9' range */
index 0b99d6a..9c2fae4 100644 (file)
@@ -306,10 +306,10 @@ void record_sample (int s, const struct sensors_event_t* event)
 
        cell = &global_history[i];
 
-       cell->sensor            = s;
+       cell->sensor = s;
 
-       cell->motion_trigger    = (sensor[s].selected_trigger ==
-                                  sensor[s].motion_trigger_name);
+       cell->motion_trigger = (sensor[s].selected_trigger ==
+                               sensor[s].motion_trigger_name);
 
        memcpy(&cell->data, event, sizeof(sensors_event_t));
 }
index f71d6fd..ce2c5e9 100644 (file)
@@ -546,9 +546,9 @@ float acquire_immediate_value(int s, int c)
                return 0;
 
        /*
-       There is no transform ops defined yet for Raw sysfs values
-        Use this function to perform transformation as well.
-       */
+        * There is no transform ops defined yet for raw sysfs values.
+         * Use this function to perform transformation as well.
+        */
        if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD)
                 return  CONVERT_GAUSS_TO_MICROTESLA ((val + offset) * scale) *
                        correction;