From patchwork Thu Jun 9 15:51:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 7224 Return-path: Envelope-to: mchehab@pedra Delivery-date: Thu, 09 Jun 2011 13:28:20 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QUi5k-00010E-CN for mchehab@pedra; Thu, 09 Jun 2011 13:28:20 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 09 Jun 2011 13:28:20 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QUhWj-0006Jy-Rp; Thu, 09 Jun 2011 15:52:10 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753982Ab1FIPwI (ORCPT + 1 other); Thu, 9 Jun 2011 11:52:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26210 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752781Ab1FIPwF (ORCPT ); Thu, 9 Jun 2011 11:52:05 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p59Fq1aG021083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Jun 2011 11:52:01 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p59Fq0FD024383; Thu, 9 Jun 2011 11:52:00 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson , Andy Walls , stable@kernel.org Subject: [PATCH] [media] lirc_zilog: fix spinning rx thread Date: Thu, 9 Jun 2011 11:51:56 -0400 Message-Id: <1307634716-10809-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: 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... CC: Andy Walls CC: stable@kernel.org Signed-off-by: Jarod Wilson Acked-by: Andy Walls --- drivers/staging/lirc/lirc_zilog.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index dd6a57c..4e051f6 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c @@ -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