OSDN Git Service

Winter cleanup: use consistent types for constants
authorPatrick Porlan <patrick.porlan@intel.com>
Wed, 17 Dec 2014 16:32:23 +0000 (17:32 +0100)
committerGerrit Code Review <gerrit2@irsgerrit001.ir.intel.com>
Thu, 18 Dec 2014 08:37:11 +0000 (08:37 +0000)
LL is 64 bits
.0 is double
f is float

Change-Id: Ib19b8e09e767ed69c97f973797451156af2cb7b5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
control.c
entry.c

index cbda333..57bad95 100644 (file)
--- a/control.c
+++ b/control.c
@@ -560,7 +560,7 @@ static void* acquisition_routine (void* param)
                        goto exit;
                }
 
-               period = (int64_t) (1000000000LL / sensor[s].sampling_rate);
+               period = (int64_t) (1000000000.0 / sensor[s].sampling_rate);
                timestamp += period;
                set_timestamp(&target_time, timestamp);
 
@@ -1148,7 +1148,7 @@ void set_report_ts(int s, int64_t ts)
        if (sensor[s].report_ts && sensor[s].sampling_rate &&
                REPORTING_MODE(sensor_desc[s].flags) == SENSOR_FLAG_CONTINUOUS_MODE)
        {
-               period = (int64_t) (1000000000LL / sensor[s].sampling_rate);
+               period = (int64_t) (1000000000.0 / sensor[s].sampling_rate);
                maxTs = sensor[s].report_ts + THRESHOLD * period;
                /* If we're too far behind get back on track */
                if (ts - maxTs >= MAX_DELAY)
@@ -1379,7 +1379,7 @@ static void synthetize_duplicate_samples (void)
                if (!sensor[s].sampling_rate)
                        continue;
 
-               period = (int64_t) (1000000000.0/ sensor[s].sampling_rate);
+               period = (int64_t) (1000000000.0 / sensor[s].sampling_rate);
 
                current_ts = get_timestamp_boot();
                target_ts = sensor[s].report_ts + period;
@@ -1563,7 +1563,7 @@ int sensor_set_delay (int s, int64_t ns)
                return -EINVAL;
        }
 
-       requested_sampling_rate = 1000000000.0/ns;
+       requested_sampling_rate = 1000000000.0 / ns;
 
        ALOGV("Entering set delay S%d (%s): current rate: %f, requested: %f\n",
                s, sensor[s].friendly_name, sensor[s].sampling_rate,
diff --git a/entry.c b/entry.c
index baa8017..50f232e 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -31,7 +31,7 @@ static int activate (__attribute__((unused)) struct sensors_poll_device_t* dev,
        if (enabled && sensor_get_quirks(handle) & QUIRK_INITIAL_RATE) {
                ALOGI("Forcing initial sampling rate\n");
                sensor_activate(handle, 1, 0);
-               sensor_set_delay(handle, 100000000L);   /* Start with 100 ms */
+               sensor_set_delay(handle, 100000000);    /* Start with 100 ms */
                sensor_activate(handle, 0, 0);
 
                /* Clear flag for this sensor as do this only once */