From patchwork Mon Nov 24 07:48:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5363761 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 6D3469F319 for ; Mon, 24 Nov 2014 07:51:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79063200D5 for ; Mon, 24 Nov 2014 07:51:43 +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 9554B202FF for ; Mon, 24 Nov 2014 07:51:42 +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 1XsoOb-0008NE-QM; Mon, 24 Nov 2014 07:49:17 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XsoOW-0007Xa-SU for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 07:49:13 +0000 Received: by mail-pa0-f54.google.com with SMTP id fb1so9066546pad.13 for ; Sun, 23 Nov 2014 23:48:51 -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=9En+rvWAdfMSMQudRY3iw9WMv1yWUsoEv14l99ufwHw=; b=vWELRHK5W/5DXdxjkv7P1KRYdM7LKagz1NrgIisPsGAe8VLa/galk1QsGZL48/kIZO x3iCe9Pa8gPePTxMLKbXKdoeyB9YATzETNH0PHdSp/lKtF+3DyFcbNhtKkwzRgfbNqN1 Kvr2P/4tGbN8medEv86e3rLF96DR7QU/TMpCmc/sRyW2qExSTEaHws36Y37x+0/7ZXdJ izAy65k70KM4ShexYtJ/UomC6Xu2zHzeQLLRTzjHohWoYb6TWeLkhyj373Z+Uz1Dt2kn OyI8yHcXA5dYu3pUhXnFR+UqUCkqIEg9QexJzAbzD2FXAXe5Qvg/oYqo0VPOtyaSTOTG D23w== X-Received: by 10.68.231.33 with SMTP id td1mr30445185pbc.26.1416815331330; Sun, 23 Nov 2014 23:48:51 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id fv6sm11534443pdb.83.2014.11.23.23.48.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Nov 2014 23:48:50 -0800 (PST) From: Dmitry Eremin-Solenikov To: Greg Kroah-Hartman , Robert Jarzmik Subject: [PATCH] serial: pxa: hold port.lock when reporting modem line changes Date: Mon, 24 Nov 2014 10:48:33 +0300 Message-Id: <1416815313-20891-1-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141123_234912_978834_10EB5353 X-CRM114-Status: GOOD ( 10.84 ) X-Spam-Score: -0.8 (/) Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.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 --- 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 2f4c329..b59dcb1 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; @@ -258,7 +259,9 @@ static inline irqreturn_t serial_pxa_irq(int irq, void *dev_id) lsr = serial_in(up, UART_LSR); if (lsr & UART_LSR_DR) receive_chars(up, &lsr); + spin_lock(&up->port.lock); check_modem_status(up); + spin_unlock(&up->port.lock); if (lsr & UART_LSR_THRE) transmit_chars(up); return IRQ_HANDLED;