Skip to contentSkip to conversation

lirc_zilog: fix spinning rx thread

PATCH In review Jarod Wilson 2 participants 2 messages Jun 9, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lirc_zilog: fix spinning rx thread

We were calling schedule_timeout with the rx thread's task state still at TASK_RUNNING, which it shouldn't be. Make sure we call set_current_state(TASK_INTERRUPTIBLE) *before* schedule_timeout, and we're all good here. I believe this problem was mistakenly introduced in commit 5bd6b0464b68d429bc8a3fe6595d19c39dfc4d95, and I'm not sure how I missed it before, as I swear I tested the patchset that was included in, but alas, stuff happens...

---
 drivers/staging/lirc/lirc_zilog.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lirc/lirc_zilog.c +2 -2
index dd6a57c..4e051f6 100644
@@ -475,14 +475,14 @@ static int lirc_thread(void *arg)
 	dprintk("poll thread started\n");
 
 	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
+
 		/* if device not opened, we can sleep half a second */
 		if (atomic_read(&ir->open_count) == 0) {
 			schedule_timeout(HZ/2);
 			continue;
 		}
 
-		set_current_state(TASK_INTERRUPTIBLE);
-
 		/*
 		 * This is ~113*2 + 24 + jitter (2*repeat gap + code length).
 		 * We use this interval as the chip resets every time you poll
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 47 lines · Jarod Wilson

We were calling schedule_timeout with the rx thread's task state still at TASK_RUNNING, which it shouldn't be. Make sure we call set_current_state(TASK_INTERRUPTIBLE) *before* schedule_timeout, and we're all good here. I believe this problem was mistakenly introduced in
commit 5bd6b0464b68d429bc8a3fe6595d19c39dfc4d95, and I'm not sure how I missed it before, as I swear I tested the patchset that was included in,
but alas, stuff happens...

---
drivers/staging/lirc/lirc_zilog.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lirc/lirc_zilog.c +2 -2
index dd6a57c..4e051f6 100644
@@ -475,14 +475,14 @@ static int lirc_thread(void *arg)
 	dprintk("poll thread started\n");
 
 	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
+
 		/* if device not opened, we can sleep half a second */
 		if (atomic_read(&ir->open_count) == 0) {
 			schedule_timeout(HZ/2);
 			continue;
 		}
 
-		set_current_state(TASK_INTERRUPTIBLE);
-
 		/*
 		 * This is ~113*2 + 24 + jitter (2*repeat gap + code length).
 		 * We use this interval as the chip resets every time you poll
Signature · 7 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media"
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html