From patchwork Fri Apr 29 08:23:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 8978311 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E03D9F39D for ; Fri, 29 Apr 2016 08:25:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3F6620220 for ; Fri, 29 Apr 2016 08:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8D5C20212 for ; Fri, 29 Apr 2016 08:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752641AbcD2IZE (ORCPT ); Fri, 29 Apr 2016 04:25:04 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34410 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752622AbcD2IZB (ORCPT ); Fri, 29 Apr 2016 04:25:01 -0400 Received: by mail-wm0-f67.google.com with SMTP id n129so3252616wmn.1; Fri, 29 Apr 2016 01:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dFoFASkcZIfSSkEMyYYg/NID6nhnqXbfagichB7OYDE=; b=kmLv0DqdSbpVGGC3Y+qic9VRpn6gyYEwj2o+ZyI/fvOSl1aPzAJEjcKkTb3jNT/03t OQIhVOTkcsGbnAbJWLJ7OzSb6p6nXw+Bi1K9qIjUL71FsouprVSU3LhQi4I0le1hc3sz swRA2f7cctAQCJBNBl/+EPen+010xWDXpmqKqFs774Umi5QS8jsLe0yT3rtMIdRtxX8W RBLJ6q+58NjT1w+fQgoPaEPuVAXuXMoIcZ2qoLp/xicTzV5jgjJ//bDn4XWmiiRlM+3U mDu4L1+DsBc1m322qDUCFBO6S9ON61qJiYqzHx/Sy5EJdbTYqqKCbSbOo3X2D/TU8+m3 iAKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dFoFASkcZIfSSkEMyYYg/NID6nhnqXbfagichB7OYDE=; b=G8V72OlBFUMf1mJMCSbsR3azdPYW++0J2sllW40qSVioXcP51S6t5AO473jYOz/56W 1lj7HorZtWaYfLH0lAD3wIOGyV3DPuyhrylGK4rbavvLirzBOh1s2qu/VOcTFexjVhIx 1lYoVkgbgVWrSI02B+u2h7JnjNkG2iBpGQYY5Gr48nPEc7o8WHERlfBXwoAGjoWXn84c mFSYur4f4DHEoSsA3JX/0ZYnX08HWuiIZh+GSF2cCuGa77irk5QcIodYGgWXPJa+wbnZ GMWyq71Wm3UMfQedgDd8lZgUJXOB7kNhs5e61Tx8T0zEfMORpvBxUDGlCSJwRV7TwC6C /wUQ== X-Gm-Message-State: AOPr4FXz/0s6k/Qv7yWf1mNRVP15T0fGlPYpa7YGwHhBZVE6ah1QF21+iQ6xjHNl3zkjzQ== X-Received: by 10.28.128.143 with SMTP id b137mr2306376wmd.57.1461918299299; Fri, 29 Apr 2016 01:24:59 -0700 (PDT) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id r5sm2031997wjy.37.2016.04.29.01.24.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Apr 2016 01:24:58 -0700 (PDT) From: yegorslists@googlemail.com To: linux-serial@vger.kernel.org Cc: linux-omap@vger.kernel.org, gregkh@linuxfoundation.org, bigeasy@linutronix.de, peter@hurleysoftware.com, Yegor Yefremov , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH v3] serial: mctrl_gpio: add IRQ locking Date: Fri, 29 Apr 2016 10:23:13 +0200 Message-Id: <1461918193-7121-1-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 From: Yegor Yefremov uart_handle_cts_change should be called with port->lock held. And for this to be save you must also disable irqs. CC: Uwe Kleine-König Signed-off-by: Yegor Yefremov --- Changes: v3: send this patch separately from the 8259 mctrl_gpio series and improve commit wording (Uwe Kleine-König) drivers/tty/serial/serial_mctrl_gpio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index bb5e4f9..85b77ba 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -143,6 +143,9 @@ static irqreturn_t mctrl_gpio_irq_handle(int irq, void *context) struct uart_port *port = gpios->port; u32 mctrl = gpios->mctrl_prev; u32 mctrl_diff; + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); mctrl_gpio_get(gpios, &mctrl); @@ -165,6 +168,8 @@ static irqreturn_t mctrl_gpio_irq_handle(int irq, void *context) wake_up_interruptible(&port->state->port.delta_msr_wait); } + spin_unlock_irqrestore(&port->lock, flags); + return IRQ_HANDLED; }