Commit 3734f785 authored by Bernhard Walle's avatar Bernhard Walle Committed by Greg Kroah-Hartman

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: default avatarBernhard Walle <bernhard@bwalle.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef77d83f
...@@ -234,7 +234,8 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure) ...@@ -234,7 +234,8 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
int status; int status;
/* alt least every second force an update of the ambient temperature */ /* 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); status = bmp085_get_temperature(data, NULL);
if (status != 0) if (status != 0)
goto exit; goto exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment