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: 1365701 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 33AE43FC66 for ; Thu, 23 Aug 2012 10:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030231Ab2HWKj4 (ORCPT ); Thu, 23 Aug 2012 06:39:56 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:50637 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933887Ab2HWKh6 (ORCPT ); Thu, 23 Aug 2012 06:37:58 -0400 Received: from mail-lpp01m010-f42.google.com ([209.85.215.42]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKUDYIBKsHw9wcxyFsVeH3Ytwr+78LFG5v@postini.com; Thu, 23 Aug 2012 03:37:57 PDT Received: by lahl5 with SMTP id l5so333618lah.29 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=hxTD9XFNu7/SZSagVhxP7DVOm6c1T/kFiyASv/bYDPNKM5HI0bz9b7ydE+cbIm2Jho HtIuiIK9ZDu/BQfV6lDeJXPyoRSaFluwbXqufMv/jTwE+tFrOecEO+r8Mi7/VUqHT2b4 C0QB+0alzwG61Wx6rB9bmgbHK1xQSN7+GduNPcvH79jP5XgXt/g3TTRwTEvKBOgKMBQu RAEw5XbxgLmdt6LejxBdMUlz7b/OkR2nSlQswU/Gnk2D+fVc14FyKvrURjwjIbOTDVK6 ua9fU+kYni9CYrhNMyKbkXmsCAVHo3PYfvZeTUAL0iQJSXL6vx3bpCwgE+92s6bwzMip EXNg== 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 Cc: Tony Lindgren , Kevin Hilman , Linux OMAP Mailing List , Linux ARM Kernel Mailing List , linux-serial@vger.kernel.org, Linux Kernel Mailing List , Santosh Shilimkar , Shubhrajyoti Datta , Sourav Poddar , Felipe Balbi 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: ALoCoQmSH3HQ+wI2iwINqoTG+BjiJ89FUx6LxQnGokTDifCkxFZ3ya15AiDeUEi9tPrkuqYyLn6s Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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; }