From patchwork Mon May 9 19:59:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 6574 Return-path: Envelope-to: mchehab@gaivota Delivery-date: Mon, 09 May 2011 22:01:03 +0200 Received: from mchehab by gaivota with local (Exim 4.73) (envelope-from ) id 1QJWdb-0001m4-0S for mchehab@gaivota; Mon, 09 May 2011 22:01:03 +0200 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.19) for (single-drop); Mon, 09 May 2011 22:01:02 +0200 (CEST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1QJWc9-0001zJ-8t; Mon, 09 May 2011 19:59:33 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754658Ab1EIT7V (ORCPT + 1 other); Mon, 9 May 2011 15:59:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22645 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754667Ab1EIT7U (ORCPT ); Mon, 9 May 2011 15:59:20 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p49JxIrS012898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 May 2011 15:59:18 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p49JxIfv006595; Mon, 9 May 2011 15:59:18 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson , =?UTF-8?q?Juan=20Jes=C3=BAs=20Garc=C3=ADa=20de=20Soria?= Subject: [PATCH] [media] ite-cir: finish tx before suspending Date: Mon, 9 May 2011 15:59:16 -0400 Message-Id: <1304971156-26650-1-git-send-email-jarod@redhat.com> In-Reply-To: <4DC84470.7060603@redhat.com> References: <4DC84470.7060603@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab Continuing with IR transmit after resuming from suspend seems fairly useless, given that the only place we can actually end up suspending is after IR has been send and we're simply mdelay'ing. Lets simplify the resume path by just waiting on tx to complete in the suspend path, then we know we can't be transmitting on resume, and reinitialization of the hardware registers becomes more straight-forward. CC: Juan Jesús García de Soria Signed-off-by: Jarod Wilson --- Nb: this patch relies upon my earlier patch to add the init_hardware calls to the resume path in the first place. drivers/media/rc/ite-cir.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index d1dec5c..e716b93 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1650,6 +1650,9 @@ static int ite_suspend(struct pnp_dev *pdev, pm_message_t state) ite_dbg("%s called", __func__); + /* wait for any transmission to end */ + wait_event_interruptible(dev->tx_ended, !dev->transmitting); + spin_lock_irqsave(&dev->lock, flags); /* disable all interrupts */ @@ -1670,15 +1673,10 @@ static int ite_resume(struct pnp_dev *pdev) spin_lock_irqsave(&dev->lock, flags); - if (dev->transmitting) { - /* wake up the transmitter */ - wake_up_interruptible(&dev->tx_queue); - } else { - /* reinitialize hardware config registers */ - dev->params.init_hardware(dev); - /* enable the receiver */ - dev->params.enable_rx(dev); - } + /* reinitialize hardware config registers */ + dev->params.init_hardware(dev); + /* enable the receiver */ + dev->params.enable_rx(dev); spin_unlock_irqrestore(&dev->lock, flags);