summaryrefslogtreecommitdiff
path: root/drivers/misc/bmp085.c
diff options
context:
space:
mode:
authorBernhard Walle <bernhard@bwalle.de>2012-02-19 18:28:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-24 14:16:43 -0800
commit3734f7858f4334d51c1cd77deff3e1e66517e261 (patch)
treea7cecf353c948546e792c636f3e761ed9c6ffb4a /drivers/misc/bmp085.c
parentef77d83fd7a2f37a20d9e37ac156f18e7e105c75 (diff)
misc: bmp085: Handle jiffies overflow correctly
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>
Diffstat (limited to 'drivers/misc/bmp085.c')
-rw-r--r--drivers/misc/bmp085.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/misc/bmp085.c b/drivers/misc/bmp085.c
index 3c534aba6272..b088abc0f45b 100644
--- a/drivers/misc/bmp085.c
+++ b/drivers/misc/bmp085.c
@@ -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;