Skip to content

Commit

Permalink
misc: bmp085: Handle jiffies overflow correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bernhard Walle authored and Greg Kroah-Hartman committed Feb 24, 2012
1 parent ef77d83 commit 3734f78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/misc/bmp085.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3734f78

Please sign in to comment.