Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8204769pxb; Fri, 19 Feb 2021 09:54:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn+8Wad4hXNdrLji4pqyBMLttNrGPIK2YWuiaG4NzltqoeAqTsBJeeXML+TERbVpIzpti2 X-Received: by 2002:a05:6402:4242:: with SMTP id g2mr10530533edb.103.1613757271756; Fri, 19 Feb 2021 09:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613757271; cv=none; d=google.com; s=arc-20160816; b=sY/iUKsZ/0mxn4p1Z1Crx0knarZFsMhcf+uRnthRebxPaRau4HJ4z1aQ/P45ixUWtT cCZlhcTpn14dYN4GtWhu2FAmOQB2Wjflr14Wt/t+wBa8c8gT2Hrj5aOtZ+4ahBtYWvIQ N3ZT91KElFtjCPT+l9NexI321VKjf/o+dBeNBoidPHqrt/1NNuOfRINg3gOx93TidCRr H8Bg0Jz8zZIOjE3BHDheze/h03dG9Vs/rnEUhM4IjhuL/+3+vhmZia50Gd6xkR2m9tZ6 23rTzG2+8yNA1Sgapvf9VThaS1P6P7XXZhDIZQhlJMCwDJ6I32HhJNLgnrGwSgvKOdKe wKbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5rp77KHJSkNMbv0vgfogbMZVaU4FQ9C+i/WQz+Fhcx4=; b=GeaEFIHouwLPcXqkiso61jlK2oBeVRT/iLZ5SmJ5pZh71MNeCU6WBVbKz/cpdV7Vd2 5NQKgFPZIgMdrMiOw4eGNs77EUi6fw9H2JNkSqHkJSCZ8pqYXRDl1bG3inLXME6wNLtv GHAHhoqBkEnwy7+JNRrh0M6XeuzDjNp4IfBBIjmcNvnlh1Qe0renW9BfAaTKwrRsUNP5 cUfTUxd5iJRyc5MyCkT3Iuba9z7blyuqqtC31PcXQeoeDpiuerFG3caeOA4Y7STvnT4Q HbdklgUD43TMlbkbGgAffj9NcvUGhtrB/It/cZoXERyy0ZncpWPq64r1xxPDh2aWrhfk uDpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=lAqovFkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si2566966edd.532.2021.02.19.09.53.58; Fri, 19 Feb 2021 09:54:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=lAqovFkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhBSRup (ORCPT + 99 others); Fri, 19 Feb 2021 12:50:45 -0500 Received: from mx07-00178001.pphosted.com ([185.132.182.106]:23564 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbhBSRsi (ORCPT ); Fri, 19 Feb 2021 12:48:38 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11JHgIIp007922; Fri, 19 Feb 2021 18:47:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=5rp77KHJSkNMbv0vgfogbMZVaU4FQ9C+i/WQz+Fhcx4=; b=lAqovFkUlFhM8LXmuGOJXGZhS8AE8h+0lpnosaJOv5T3dDoO6JMTU6O97ikVYkvExVX9 YXuSzSPJc/oMQmsqW8Oq5f1+Q/b2OUAZPXliePb7Jspb2BCXogcOomia5fFHIeCzNwlo eU+PT0abuczU/aiAEstdYykJZKjjeoINfyJtv9+TsKiDlZ5EU8nkaWlLX60xM5TLShft j6o+jsn0EUZnii6bPqufLDQzPbSaixFVUuXdJQJymwqeauiVf/Mcw6Hw17v9T+HtWirJ KZv/GPRyySuzjEpvpJV1Cb+iVcL4jf+UyTF4irnxJNS4yVH+I3QMWRHXUr1wRYIUtbky FA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 36sqadhax8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 18:47:49 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E922010002A; Fri, 19 Feb 2021 18:47:48 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DD8EB25F3FC; Fri, 19 Feb 2021 18:47:48 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 19 Feb 2021 18:47:48 +0100 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , Alexandre Torgue CC: , , , , Erwan Le Ray , Fabrice Gasnier , Valentin Caron Subject: [PATCH 09/13] serial: stm32: call stm32_transmit_chars locked Date: Fri, 19 Feb 2021 18:47:32 +0100 Message-ID: <20210219174736.1022-10-erwan.leray@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210219174736.1022-1-erwan.leray@foss.st.com> References: <20210219174736.1022-1-erwan.leray@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-19_08:2021-02-18,2021-02-19 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org stm32_transmit_chars should be called under lock also in tx DMA callback. Fixes: 3489187204eb ("serial: stm32: adding dma support") Signed-off-by: Erwan Le Ray Signed-off-by: Fabrice Gasnier diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 7da16d468b84..bdd7ca490021 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -291,13 +291,16 @@ static void stm32_usart_tx_dma_complete(void *arg) struct uart_port *port = arg; struct stm32_port *stm32port = to_stm32_port(port); struct stm32_usart_offsets *ofs = &stm32port->info->ofs; + unsigned long flags; dmaengine_terminate_async(stm32port->tx_ch); stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT); stm32port->tx_dma_busy = false; /* Let's see if we have pending data to send */ + spin_lock_irqsave(&port->lock, flags); stm32_usart_transmit_chars(port); + spin_unlock_irqrestore(&port->lock, flags); } static void stm32_usart_tx_interrupt_enable(struct uart_port *port) -- 2.17.1