lkml.org 
[lkml]   [2008]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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@fries.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[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-03-28 13:55    [from the cache]
©2003-2011 Jasper Spaans