From patchwork Thu Aug 23 10:32:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1366241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id C5EA93FC66 for ; Thu, 23 Aug 2012 10:49:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4UvF-00067d-2q; Thu, 23 Aug 2012 10:45:58 +0000 Received: from na3sys009aog101.obsmtp.com ([74.125.149.67]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1T4UnW-000128-LO for linux-arm-kernel@lists.infradead.org; Thu, 23 Aug 2012 10:37:59 +0000 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob101.postini.com ([74.125.148.12]) with SMTP ID DSNKUDYIBKsHw9wcxyFsVeH3Ytwr+78LFG5v@postini.com; Thu, 23 Aug 2012 03:37:58 PDT Received: by lagy9 with SMTP id y9so353576lag.33 for ; Thu, 23 Aug 2012 03:37:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=7/qNKbiSFd5+mPSEP6sNM1v4a4uexkXTm5FHK1iABQA=; b=GuehCxab/6N5M7Yeumzd88aEfjKK9189UJq+UnRsHBRSPT8us+dbfuD3wqn/u+mmJT xe5SuW/YEJEbQJZZxRJx/Fpp7mQamcu3peY3qiCLVEOPcztoB2GJgE6ZeJWHGYV/D/Oi 3bv4DEgYVA9JHF5/EzITlTCGyNUk7nGMgugS1Wx9ZuWoqHJDTzsQTIARGN6363g3I5T0 FthR0gsw6X3NquO3Z8r7RqKGh3L8/yYgdMFcs1Wq12xSLPY9Z9iCl0X8+e+lEuNnXAdL 7OJm3GwNMsS7mRKre7v3/6mYJCqzsFnACyzCmGNIAlcsy+U1EHiBCECAHXNfDiiWrCVr ywVg== Received: by 10.112.46.135 with SMTP id v7mr704583lbm.3.1345718275204; Thu, 23 Aug 2012 03:37:55 -0700 (PDT) Received: from localhost (cs78217178.pp.htv.fi. [62.78.217.178]) by mx.google.com with ESMTPS id lx11sm7098397lab.4.2012.08.23.03.37.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Aug 2012 03:37:54 -0700 (PDT) From: Felipe Balbi To: alan@linux.intel.com Subject: [PATCH v3 19/23] serial: omap: make sure to put() on poll_get_char Date: Thu, 23 Aug 2012 13:32:59 +0300 Message-Id: <1345717983-18179-20-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.12.rc3 In-Reply-To: <1345717983-18179-1-git-send-email-balbi@ti.com> References: <1345717983-18179-1-git-send-email-balbi@ti.com> X-Gm-Message-State: ALoCoQkD81/GOC2sfhQCv5MCtAwY29xbFYnNOudEH9JlP0KvPvxymX6YXOEf5jRUdCpI/3BXOvF/ X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.67 listed in list.dnswl.org] 0.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Kevin Hilman , Tony Lindgren , Linux Kernel Mailing List , Felipe Balbi , Santosh Shilimkar , linux-serial@vger.kernel.org, Sourav Poddar , Linux OMAP Mailing List , Shubhrajyoti Datta , Linux ARM Kernel Mailing List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org if we would reach serial_omap_get_char() while Data Ready bit isn't set, we would return from it without kicking our pm timer. This would mean we would, eventually, have an unbalanced pm_runtime_get on our device which would prevent it from ever sleeping again. Tested-by: Shubhrajyoti D Signed-off-by: Felipe Balbi --- drivers/tty/serial/omap-serial.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index d6f5eed..c3579c0 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -991,12 +991,17 @@ static int serial_omap_poll_get_char(struct uart_port *port) pm_runtime_get_sync(up->dev); status = serial_in(up, UART_LSR); - if (!(status & UART_LSR_DR)) - return NO_POLL_CHAR; + if (!(status & UART_LSR_DR)) { + status = NO_POLL_CHAR; + goto out; + } status = serial_in(up, UART_RX); + +out: pm_runtime_mark_last_busy(up->dev); pm_runtime_put_autosuspend(up->dev); + return status; }