[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080328122456.GG3613@spacedout.fries.net>
Date: Fri, 28 Mar 2008 07:24:56 -0500
From: David Fries <david@...es.net>
To: linux-kernel@...r.kernel.org
Cc: Evgeniy Polyakov <johnpol@....mipt.ru>
Subject: [PATCH 6/35] W1: w1_process, block when there's nothing to do
w1.c 1.10
Instead of sleeping with a timeout, it will now sleep with a timeout
only when there is an active bus search. When the search is not
active it will block until something wakes it up. kthread_stop and
changing the search_count will wake up the thread. Now if the search
value is changed (to request a new search) it will wake up and do the
search immediately, rather than waiting for the end of the current
timeout.
Signed-off-by: David Fries <david@...es.net>
---
drivers/w1/w1.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 7dd34f2..5d8c2c7 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -251,6 +251,7 @@ static ssize_t w1_master_attribute_store_search(struct device * dev,
mutex_lock(&md->mutex);
md->search_count = simple_strtol(buf, NULL, 0);
mutex_unlock(&md->mutex);
+ wake_up_process(md->thread);
return count;
}
@@ -828,7 +829,11 @@ int w1_process(void *data)
if(kthread_should_stop())
break;
- schedule_timeout(jtime);
+ /* Only sleep when the search is active. */
+ if(dev->search_count)
+ schedule_timeout(jtime);
+ else
+ schedule();
}
atomic_dec(&dev->refcnt);
--
1.4.4.4
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists