Commit 20f56796 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Greg Kroah-Hartman

[PATCH] w1/w1_therm: replace schedule_timeout() with msleep_interruptible()

Description: Use msleep_interruptible() instead of schedule_timeout() to
guarantee the task delays as expected. Changed tm to an int, as it now is in
terms of msecs, not jiffies.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 1274fcd6
......@@ -26,6 +26,7 @@
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/delay.h>
#include "w1.h"
#include "w1_io.h"
......@@ -128,7 +129,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
if (!w1_reset_bus (dev)) {
int count = 0;
u8 match[9] = {W1_MATCH_ROM, };
unsigned long tm;
unsigned int tm = 750;
memcpy(&match[1], (u64 *) & sl->reg_num, 8);
......@@ -136,11 +137,8 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
w1_write_8(dev, W1_CONVERT_TEMP);
tm = jiffies + msecs_to_jiffies(750);
while(time_before(jiffies, tm)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(tm-jiffies);
while (tm) {
tm = msleep_interruptible(tm);
if (signal_pending(current))
flush_signals(current);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment