From: Bernhard Walle <bernhard@bwalle.de>
To: christoph.mair@gmail.com
Cc: arnd@arndb.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] misc: bmp085: Handle jiffies overflow correctly
Date: Sun, 19 Feb 2012 18:28:01 +0100 [thread overview]
Message-ID: <1329672481-19583-1-git-send-email-bernhard@bwalle.de> (raw)
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
next reply other threads:[~2012-02-19 17:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-19 17:28 Bernhard Walle [this message]
2012-02-20 12:10 ` Arnd Bergmann
2012-02-24 22:18 ` Greg KH
2012-02-25 9:28 ` [PATCH] misc: bmp085: Use unsigned long to store jiffies Bernhard Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1329672481-19583-1-git-send-email-bernhard@bwalle.de \
--to=bernhard@bwalle.de \
--cc=arnd@arndb.de \
--cc=christoph.mair@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®