From patchwork Wed Nov 26 09:21:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5384481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3ADA49F39B for ; Wed, 26 Nov 2014 09:25:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ADE420160 for ; Wed, 26 Nov 2014 09:25:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AE712015E for ; Wed, 26 Nov 2014 09:25:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XtYnw-000785-Lh; Wed, 26 Nov 2014 09:22:32 +0000 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XtYns-00073w-HN for linux-arm-kernel@lists.infradead.org; Wed, 26 Nov 2014 09:22:29 +0000 Received: by mail-wg0-f46.google.com with SMTP id x12so3121504wgg.5 for ; Wed, 26 Nov 2014 01:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=wJw3V219RTC1mgvwYjbJqQZ0HXcWT9HX1gq4Qqpx5y4=; b=fcydJy5IJnpkKhSfsywuuukRbcOa0Ao7hyT2SZcnb3oB7X9cITFM/4H0fOHtf3ZxS7 miTYTjNNyJo0Ykk9C4L7ESDGRrmB5WnDxrsOozVYQJ7ifyjkbT2+QWcBPPHDte0xV6pt WiyEY68xwdSgVWGMmInCRjX8SkHyJrTLHwipkPWOXKiZ2mudF+zFlM3WJMaVyNjs6/5X Qfjo6Ezgn/lmurkzPA8jjwzWKbyRd0T7nAxf/of/TB7/9wBckoh8g0Pc/yD16Buwjv1H olnd8sA+Z3d9rG6DLIA6ZJmT0j47q0+6MKYkso+mXcGALL6G2LfM/G3U9k5IeMAgfQlC otqg== X-Received: by 10.194.78.82 with SMTP id z18mr45496739wjw.120.1416993726166; Wed, 26 Nov 2014 01:22:06 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id hz9sm5524395wjb.17.2014.11.26.01.22.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 01:22:05 -0800 (PST) From: Dmitry Eremin-Solenikov To: Greg Kroah-Hartman , Robert Jarzmik Subject: [PATCH V2] serial: pxa: hold port.lock when reporting modem line changes Date: Wed, 26 Nov 2014 12:21:56 +0300 Message-Id: <1416993716-21005-1-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141126_012228_816304_FDD08782 X-CRM114-Status: GOOD ( 10.72 ) X-Spam-Score: -0.8 (/) Cc: Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both uart_handle_dcd_change() and uart_handle_cts_change() require a port lock to be held and will emit a warning when lockdep is enabled. Held corresponding lock. This fixes the following warnings: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at drivers/tty/serial/serial_core.c:2760 uart_handle_dcd_change+0xc8/0xf8() Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.18.0-rc5+ #26 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (warn_slowpath_common+0x6c/0x8c) [] (warn_slowpath_common) from [] (warn_slowpath_null+0x1c/0x24) [] (warn_slowpath_null) from [] (uart_handle_dcd_change+0xc8/0xf8) [] (uart_handle_dcd_change) from [] (serial_pxa_irq+0x268/0x3b0) [] (serial_pxa_irq) from [] (handle_irq_event_percpu+0x50/0x16c) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x3c/0x5c) [] (handle_irq_event) from [] (handle_level_irq+0x94/0x118) [] (handle_level_irq) from [] (generic_handle_irq+0x20/0x30) [] (generic_handle_irq) from [] (__handle_domain_irq+0x38/0x70) [] (__handle_domain_irq) from [] (ichp_handle_irq+0x24/0x34) [] (ichp_handle_irq) from [] (__irq_svc+0x44/0x54) Exception stack(0xc07c7f58 to 0xc07c7fa0) 7f40: 00000001 00000001 7f60: 00000000 20000013 c07c6000 00000000 00000000 c07ce0a4 c07d7798 00000000 7f80: c07e8fb8 0000004c 00000000 c07c7fa0 c0044798 c0009f20 20000013 ffffffff [] (__irq_svc) from [] (arch_cpu_idle+0x28/0x38) [] (arch_cpu_idle) from [] (cpu_startup_entry+0x1b8/0x220) [] (cpu_startup_entry) from [] (start_kernel+0x39c/0x40c) ---[ end trace 4c1b7ae03f6d9d30 ]--- ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at drivers/tty/serial/serial_core.c:2791 uart_handle_cts_change+0xa0/0xdc() Modules linked in: CPU: 0 PID: 0 Comm: swapper Tainted: G W 3.18.0-rc5+ #26 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (warn_slowpath_common+0x6c/0x8c) [] (warn_slowpath_common) from [] (warn_slowpath_null+0x1c/0x24) [] (warn_slowpath_null) from [] (uart_handle_cts_change+0xa0/0xdc) [] (uart_handle_cts_change) from [] (serial_pxa_irq+0x258/0x3b0) [] (serial_pxa_irq) from [] (handle_irq_event_percpu+0x50/0x16c) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x3c/0x5c) [] (handle_irq_event) from [] (handle_level_irq+0x94/0x118) [] (handle_level_irq) from [] (generic_handle_irq+0x20/0x30) [] (generic_handle_irq) from [] (__handle_domain_irq+0x38/0x70) [] (__handle_domain_irq) from [] (ichp_handle_irq+0x24/0x34) [] (ichp_handle_irq) from [] (__irq_svc+0x44/0x54) Exception stack(0xc07c7f58 to 0xc07c7fa0) 7f40: 00000001 00000001 7f60: 00000000 20000013 c07c6000 00000000 00000000 c07ce0a4 c07d7798 00000000 7f80: c07e8fb8 0000004c 00000000 c07c7fa0 c0044798 c0009f20 20000013 ffffffff [] (__irq_svc) from [] (arch_cpu_idle+0x28/0x38) [] (arch_cpu_idle) from [] (cpu_startup_entry+0x1b8/0x220) [] (cpu_startup_entry) from [] (start_kernel+0x39c/0x40c) ---[ end trace 4c1b7ae03f6d9d31 ]--- Signed-off-by: Dmitry Eremin-Solenikov Acked-by: Robert Jarzmik --- [Changes since v1 - lock whole function, not just check_modem_status().] drivers/tty/serial/pxa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 21b7d8b8..7788d53 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -223,6 +223,7 @@ static void serial_pxa_start_tx(struct uart_port *port) } } +/* should hold up->port.lock */ static inline void check_modem_status(struct uart_pxa_port *up) { int status; @@ -255,12 +256,14 @@ static inline irqreturn_t serial_pxa_irq(int irq, void *dev_id) iir = serial_in(up, UART_IIR); if (iir & UART_IIR_NO_INT) return IRQ_NONE; + spin_lock(&up->port.lock); lsr = serial_in(up, UART_LSR); if (lsr & UART_LSR_DR) receive_chars(up, &lsr); check_modem_status(up); if (lsr & UART_LSR_THRE) transmit_chars(up); + spin_unlock(&up->port.lock); return IRQ_HANDLED; }