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>
This commit is contained in:
Bernhard Walle 2012-02-19 18:28:01 +01:00 committed by Greg Kroah-Hartman
parent ef77d83fd7
commit 3734f7858f

View 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;