misc: bmp085: Handle jiffies overflow correctly
authorBernhard Walle <bernhard@bwalle.de>
Sun, 19 Feb 2012 17:28:01 +0000 (18:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Feb 2012 22:16:43 +0000 (14:16 -0800)
By using the time_is_before_jiffies() macro instead of normal
arithmetic, the jiffies overflow is handled correctly.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/bmp085.c

index 3c534ab..b088abc 100644 (file)
@@ -234,7 +234,8 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
        int status;
 
        /* alt least every second force an update of the ambient temperature */
-       if (data->last_temp_measurement + 1*HZ < jiffies) {
+       if (data->last_temp_measurement == 0 ||
+                       time_is_before_jiffies(data->last_temp_measurement + 1*HZ)) {
                status = bmp085_get_temperature(data, NULL);
                if (status != 0)
                        goto exit;