提交 3734f785 编写于 作者: B Bernhard Walle 提交者: 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: NBernhard Walle <bernhard@bwalle.de>
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ef77d83f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册