From patchwork Wed Sep 3 16:09:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 4835641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85269C0338 for ; Wed, 3 Sep 2014 16:19:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EBB720145 for ; Wed, 3 Sep 2014 16:19:08 +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 86AD720115 for ; Wed, 3 Sep 2014 16:19:06 +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 1XPD8I-0005PV-Op; Wed, 03 Sep 2014 16:10:06 +0000 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPD8F-0004by-3x for linux-arm-kernel@lists.infradead.org; Wed, 03 Sep 2014 16:10:03 +0000 Received: by mail-we0-f178.google.com with SMTP id u57so8904199wes.37 for ; Wed, 03 Sep 2014 09:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=bMJF1Z380i85YeR8m+kKoh4w4jDBGZ1Xz7ifL6GUYxs=; b=VVO7EBiVyGsU4h4J4TxBFIkQGwqh2nuykNB4r4bcy4Chs/aJlxKqZcXN1PVKS+/USg qF4F9pnxr8Y0iYlz3uxUGNo/Cg2NW53bJ5xTo/7nfJlw0yY8zgKtsutawuLX6wvCEvcR By58CDU8odvx+052OFoHa8l+QyhmEqYwT8MvgwofYdRUY4pmKEdfC+z714d51maZOZGC IUfFprQVsvaw2QQ2pZajfiZoRV5A0gVbcbDW1kHXcHuouu3oG6QtDI2zNy+H9R4f1U6d E2+9ESXB4LaZIVhproM0LIl2udhgsZBEzjR/dKf42oZjTwYazQmsLRL2ShFhrRL848Ix ROHA== X-Received: by 10.194.77.84 with SMTP id q20mr48240169wjw.2.1409760578675; Wed, 03 Sep 2014 09:09:38 -0700 (PDT) Received: from localhost (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPSA id au4sm16476675wjc.15.2014.09.03.09.09.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 09:09:37 -0700 (PDT) From: Richard Genoud To: Greg Kroah-Hartman Subject: [PATCH] tty/serial: at91: BUG: disable interrupts when !UART_ENABLE_MS() Date: Wed, 3 Sep 2014 18:09:26 +0200 Message-Id: <1409760567-13186-1-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 2.0.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140903_091003_310223_1FB86F07 X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -0.8 (/) Cc: Peter Hurley , Alexander Shiyan , Richard Genoud , Linus Walleij , Nicolas Ferre , Yegor Yefremov , 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=-3.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 In set_termios(), interrupts where not disabled if UART_ENABLE_MS() was false. Tested on at91sam9g35. CC: stable@vger.kernel.org # >= 3.16 Signed-off-by: Richard Genoud Reviewed-by: Peter Hurley Acked-by: Nicolas Ferre --- drivers/tty/serial/atmel_serial.c | 43 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 7b63677475c1..d7d4584549a5 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -527,6 +527,45 @@ static void atmel_enable_ms(struct uart_port *port) } /* + * Disable modem status interrupts + */ +static void atmel_disable_ms(struct uart_port *port) +{ + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + uint32_t idr = 0; + + /* + * Interrupt should not be disabled twice + */ + if (!atmel_port->ms_irq_enabled) + return; + + atmel_port->ms_irq_enabled = false; + + if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0) + disable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]); + else + idr |= ATMEL_US_CTSIC; + + if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0) + disable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]); + else + idr |= ATMEL_US_DSRIC; + + if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0) + disable_irq(atmel_port->gpio_irq[UART_GPIO_RI]); + else + idr |= ATMEL_US_RIIC; + + if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0) + disable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]); + else + idr |= ATMEL_US_DCDIC; + + UART_PUT_IDR(port, idr); +} + +/* * Control the transmission of a break signal */ static void atmel_break_ctl(struct uart_port *port, int break_state) @@ -1993,7 +2032,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, /* CTS flow-control and modem-status interrupts */ if (UART_ENABLE_MS(port, termios->c_cflag)) - port->ops->enable_ms(port); + atmel_enable_ms(port); + else + atmel_disable_ms(port); spin_unlock_irqrestore(&port->lock, flags); }