From patchwork Fri Apr 29 12:39:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Govindraj.R" X-Patchwork-Id: 740771 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3TCgT19019001 for ; Fri, 29 Apr 2011 12:42:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754028Ab1D2Mm1 (ORCPT ); Fri, 29 Apr 2011 08:42:27 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:36464 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753538Ab1D2Mm0 (ORCPT ); Fri, 29 Apr 2011 08:42:26 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p3TCgJcH017601 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Apr 2011 07:42:21 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3TCgHSa014917; Fri, 29 Apr 2011 18:12:18 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 8.3.106.1; Fri, 29 Apr 2011 18:11:56 +0530 Received: from GLPP-machine (glpp-machine.apr.dhcp.ti.com [172.24.137.105]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3TCgDIl022255; Fri, 29 Apr 2011 18:12:18 +0530 (IST) From: "Govindraj.R" To: , , CC: "Govindraj.R" , Tony Lindgren , Benoit Cousson , Kevin Hilman , Paul Walmsley , Rajendra Nayak Subject: [PATCH v2 05/12] OMAP: Serial: Hold console lock for console usage. Date: Fri, 29 Apr 2011 18:09:49 +0530 Message-ID: <1304080796-625-6-git-send-email-govindraj.raja@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1304080796-625-1-git-send-email-govindraj.raja@ti.com> References: <1304080796-625-1-git-send-email-govindraj.raja@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 29 Apr 2011 12:42:29 +0000 (UTC) Acquire console lock before enabling and writing to console-uart to avoid any recursive prints from console write. for ex: --> printk --> uart_console_write --> get_sync --> printk from omap_device enable --> uart_console write Also during bootup console_lock is not available. --> uart_add_one_port --> console_register --> console_lock --> console_unlock --> call_console_drivers (here yet console_lock is not released) --> uart_console_write Hence convert prints from omap_device_enable/disable to pr_debug. Signed-off-by: Govindraj.R --- arch/arm/plat-omap/omap_device.c | 8 ++++---- drivers/tty/serial/omap-serial.c | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 9bbda9a..f7c6dca 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -145,12 +145,12 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) odpl->activate_lat_worst = act_lat; if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { odpl->activate_lat = act_lat; - pr_warning("omap_device: %s.%d: new worst case " + pr_debug("omap_device: %s.%d: new worst case " "activate latency %d: %llu\n", od->pdev.name, od->pdev.id, od->pm_lat_level, act_lat); } else - pr_warning("omap_device: %s.%d: activate " + pr_debug("omap_device: %s.%d: activate " "latency %d higher than exptected. " "(%llu > %d)\n", od->pdev.name, od->pdev.id, @@ -213,12 +213,12 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat) odpl->deactivate_lat_worst = deact_lat; if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { odpl->deactivate_lat = deact_lat; - pr_warning("omap_device: %s.%d: new worst case " + pr_debug("omap_device: %s.%d: new worst case " "deactivate latency %d: %llu\n", od->pdev.name, od->pdev.id, od->pm_lat_level, deact_lat); } else - pr_warning("omap_device: %s.%d: deactivate " + pr_debug("omap_device: %s.%d: deactivate " "latency %d higher than exptected. " "(%llu > %d)\n", od->pdev.name, od->pdev.id, diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 633dfb4..7d8ca45 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1007,7 +1007,10 @@ serial_omap_console_write(struct console *co, const char *s, struct uart_omap_port *up = serial_omap_console_ports[co->index]; unsigned long flags; unsigned int ier; - int locked = 1; + int console_lock = 0, locked = 1; + + if (console_trylock()) + console_lock = 1; local_irq_save(flags); if (up->port.sysrq) @@ -1043,6 +1046,9 @@ serial_omap_console_write(struct console *co, const char *s, if (up->msr_saved_flags) check_modem_status(up); + if (console_lock) + console_unlock(); + serial_omap_port_disable(up); if (locked) spin_unlock(&up->port.lock);