lkml.org 
[lkml]   [2012]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] misc: bmp085: Handle jiffies overflow correctly
Date
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>
---
drivers/misc/bmp085.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/bmp085.c b/drivers/misc/bmp085.c
index b29a2be..7cfc598 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;
--
1.7.9.1


\
 
 \ /
  Last update: 2012-02-19 18:43    [W:0.443 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site