From 3734f7858f4334d51c1cd77deff3e1e66517e261 Mon Sep 17 00:00:00 2001 From: Bernhard Walle Date: Sun, 19 Feb 2012 18:28:01 +0100 Subject: [PATCH] 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 Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/misc/bmp085.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/misc/bmp085.c b/drivers/misc/bmp085.c index 3c534ab..b088abc 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; -- 2.7.4