From patchwork Fri Apr 29 08:45:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 8978361 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 46A429F372 for ; Fri, 29 Apr 2016 08:46:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D61B20259 for ; Fri, 29 Apr 2016 08:46:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8ACCA20220 for ; Fri, 29 Apr 2016 08:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbcD2Iqx (ORCPT ); Fri, 29 Apr 2016 04:46:53 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33072 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750925AbcD2Iqv (ORCPT ); Fri, 29 Apr 2016 04:46:51 -0400 Received: by mail-wm0-f67.google.com with SMTP id r12so3362981wme.0; Fri, 29 Apr 2016 01:46:51 -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=ujdF+w41dgJ4TCsOogFdn/kRcCTx/1rPfx0jzUWRPWQ=; b=GpHxK/iNvF1ZnzlQ1/Zv7UBIiRrLUiwHy/eXtRfMujkWYIMrgFvMBKcgXF2tCDEOTU t3vN0sk4q9NbinqCHSdL4H0jqsv5pQrn+1mJPkfsbbr3PoeLso2DjMjHDtEEYoUx2IPr l2se+Q8EKSSgM1T76mvzEOw8vC4JB5VHdfwpBQNQngpAcIxWEqGgpJhzB77MMI8XVim0 zungX7H11jowtRkMujnC/B5nLnw/SVKvqjG+U0oU4ZREpzHWpu3lJ3hEnEVrGEESuzzF hpscmMuFasoR1eGxriO505ImEaL83bdQrqUfCxRYXve6S5ntodjO/xdbYjZHHOmvhuR+ ZOYg== 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=ujdF+w41dgJ4TCsOogFdn/kRcCTx/1rPfx0jzUWRPWQ=; b=AqldGclzCZOkAhodqEMeolWSZTOnFgfvBFTKnr3xQG/5yjT3A9VxjSpUD38BHTo1lx cxOtepV3pXz3GGh400rptbwX4XYL4tD3nWq/Ukt1uod93NwZN7jcV2+65Z7z86/zBlY3 Jo4gCwve5f9jzZ0vtSLD6rZVAqm88LGdt9fMuohlUZIbYEs0tkEYSwP9x9cl7DpatNd/ +V6sg9cKzkMlPsVXS2ZhC+KDOyRN0WX6pNIEArRIXV89RqrBVP6iYg/HYBv3cI8wIIfV 7eg1sVG7/TTrPXJCiisZKNwcIg5cpkTkP3oQkTwUkBM8uGUpWQ8F1jeOAGWz+zxJnIlQ LNYQ== X-Gm-Message-State: AOPr4FXzVKTZRBXPERZCCXciuqqP9hTNxKHlfytwFS/0028c5IACk34dQH8A8mOsYMB9ng== X-Received: by 10.28.0.87 with SMTP id 84mr2527762wma.68.1461919610408; Fri, 29 Apr 2016 01:46:50 -0700 (PDT) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id kj9sm13708870wjb.14.2016.04.29.01.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Apr 2016 01:46:49 -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, u.kleine-koenig@pengutronix.de, Yegor Yefremov Subject: [PATCH v4] serial: mctrl_gpio: add IRQ locking Date: Fri, 29 Apr 2016 10:45:07 +0200 Message-Id: <1461919507-17626-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. Acked-by: Uwe Kleine-König Signed-off-by: Yegor Yefremov --- Changes: v4: move lock after mctrl_gpio_get (Uwe Kleine-König) 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..f18df52 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -143,9 +143,12 @@ 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; mctrl_gpio_get(gpios, &mctrl); + spin_lock_irqsave(&port->lock, flags); + mctrl_diff = mctrl ^ gpios->mctrl_prev; gpios->mctrl_prev = 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; }