From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76503FA3733 for ; Fri, 13 Sep 2024 09:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5nyRXAZtZaPgsiU9hSdOI+jFy3OJbheXoiy71LlZp5k=; b=YNJY9W8mwpLwzquV7+6sZg6ozK gJsiT7O4NlBxgNpv3+/RWvcBLNwC8rEtJK1I8b407sKQ3atCud704NE4sJ/9rWw3tq33JzZYBT1/T qB6fTVAI9oEDGSqictbL1IssZU2iCRfKfIcK4Xuos/58LpyyZ89OiVC3c5+5vdYZ6+U/b2wnayii1 r9oySndMSJxp7ywSqV+rk37C0MgCDt1ijqx+C5FwcHSkCLhDpQmsW+8xPSBVIANTWtYawRIgQ0/3z OuHsCqzFe57RKoNOkpcy51EUyLr5EBrQ+RgmLxKcovxEQ3djmHC8JwfOB9MgPBkdsV6C4hf2vm9/k npePapNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp2Ra-0000000FSck-2ZLK; Fri, 13 Sep 2024 09:18:22 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp2QV-0000000FSY4-1iqd for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2024 09:17:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1726219035; x=1757755035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5nyRXAZtZaPgsiU9hSdOI+jFy3OJbheXoiy71LlZp5k=; b=AdH+9txHxeZaWDfW2/Y8pl2LbcR7natT142oKNkyAh+L9AIK39Hjzgsb S3ujLrmGO46aadzVLOif28+VUjo2AK1XKTEFK8xN5r0IXu/o2mdCm/4vv FIS6lctWDIjy+bwRnA6ZoI3MtB90zUN/pcb9I4DY80wGnSaujoUY9s+Gi twKnFXMqRYD/pmS43vKG2LnV3TTCXH7dt5VjYXR/298zxPp6kMJDKraA7 2SXJhBy/n2W3wN/fvCoQyEBMd9oxWba27bvUQfH2ynkVrR68uXBpPXTP5 4OhsOCw7poL1cz4AhQQT7P8gsMrhGC76a7i9GRVzgJMmvDTCniF2GnQWz Q==; X-CSE-ConnectionGUID: p+R67PyMQLOUJgOdcEoSbQ== X-CSE-MsgGUID: XvVlXnRDRI6dXMCAF3adjg== X-IronPort-AV: E=Sophos;i="6.10,225,1719871200"; d="scan'208";a="38929837" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 13 Sep 2024 11:17:10 +0200 X-CheckPoint: {66E40316-20-5FF8EC80-F6CEE9F8} X-MAIL-CPID: 74791384B45C96BF1AA1857C48273692_0 X-Control-Analysis: str=0001.0A782F1D.66E40317.0096,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 76CBA167CB0; Fri, 13 Sep 2024 11:17:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1726219026; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=5nyRXAZtZaPgsiU9hSdOI+jFy3OJbheXoiy71LlZp5k=; b=EAnQmZSII4QJyrFQEhdzwtL9szLD0RYPMLcU4Q/LY4fcWXEfOzariAmcCYgUfGM9JQeKDZ 2j2Ap9VUdwJYLTfL6DuZu2932doAJUwzCuF0B0lZPZJ2zd/RzfjD7a/1Y9XY+YVdW8ShtW vltqnbGcxVnuvBYvydqEir6CO5HinkmwGXUccMbpUJSG+e70HkTxwgVI/WpNw6+8Y6cZaH Hlkv6Ync38Phss+7eDwPe3w3CbLVTCq9rusbSxGWI1k8PdR0Uw5E2LZM6ZNhy+pnW0q7rW 0Hy1KbF56hSS/EkGSX9g0JVL+i4c8ia0sGTZE87mxI9A16F952cTBPBTb/+5zA== From: Alexander Stein To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , John Ogness , linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Esben Haabendal , Esben Haabendal Subject: Re: [PATCH 2/2] serial: imx: Add more comments on port lock status Date: Fri, 13 Sep 2024 11:17:04 +0200 Message-ID: <2200890.irdbgypaU6@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20240913-serial-imx-lockfix-v1-2-4d102746c89d@geanix.com> References: <20240913-serial-imx-lockfix-v1-0-4d102746c89d@geanix.com> <20240913-serial-imx-lockfix-v1-2-4d102746c89d@geanix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240913_021715_932688_B99B8E9B X-CRM114-Status: GOOD ( 20.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Am Freitag, 13. September 2024, 10:39:50 CEST schrieb Esben Haabendal: > Comments regarding status of port.lock on internal functions is useful wh= en > reviewing correct handling of registers that must be protected by this > lock. >=20 > Signed-off-by: Esben Haabendal > --- > drivers/tty/serial/imx.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index efa3eb3a2c57..bea4510743ef 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -370,6 +370,7 @@ static void imx_uart_soft_reset(struct imx_port *spor= t) > sport->idle_counter =3D 0; > } > =20 > +/* called with port.lock taken and irqs off */ > static void imx_uart_disable_loopback_rs485(struct imx_port *sport) > { > unsigned int uts; I think you are referring to sport.lock. On the other hand, instead of just adding comments, wouldn't it be better to make it explicit? Adding=20 > lockdep_assert_held(&sport->port->lock); and/or sparse annoations > __must_hold(&sport->port->lock) seems more reasonable to me than adding non-enforcing comments. Best regards, Alexander > @@ -470,6 +471,7 @@ static void imx_uart_stop_tx(struct uart_port *port) > } > } > =20 > +/* called with port.lock taken and irqs off */ > static void imx_uart_stop_rx_with_loopback_ctrl(struct uart_port *port, = bool loopback) > { > struct imx_port *sport =3D to_imx_port(port); > @@ -803,6 +805,8 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_= id) > * issuing soft reset to the UART (just stop/start of RX does not help).= Note > * that what we do here is sending isolated start bit about 2.4 times sh= orter > * than it is to be on UART configured baud rate. > + * > + * Called with port.lock taken and irqs off. > */ > static void imx_uart_check_flood(struct imx_port *sport, u32 usr2) > { > @@ -838,6 +842,7 @@ static void imx_uart_check_flood(struct imx_port *spo= rt, u32 usr2) > } > } > =20 > +/* called with port.lock taken and irqs off */ > static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) > { > struct imx_port *sport =3D dev_id; > @@ -916,6 +921,7 @@ static void imx_uart_clear_rx_errors(struct imx_port = *sport); > /* > * We have a modem side uart, so the meanings of RTS and CTS are inverte= d. > */ > +/* called with port.lock taken and irqs off */ > static unsigned int imx_uart_get_hwmctrl(struct imx_port *sport) > { > unsigned int tmp =3D TIOCM_DSR; > @@ -938,6 +944,8 @@ static unsigned int imx_uart_get_hwmctrl(struct imx_p= ort *sport) > =20 > /* > * Handle any change of modem status signal since we were last called. > + * > + * Called with port.lock taken and irqs off. > */ > static void imx_uart_mctrl_check(struct imx_port *sport) > { > @@ -1277,6 +1285,7 @@ static int imx_uart_start_rx_dma(struct imx_port *s= port) > return 0; > } > =20 > +/* called with port.lock taken and irqs off */ > static void imx_uart_clear_rx_errors(struct imx_port *sport) > { > struct tty_port *port =3D &sport->port.state->port; > @@ -1407,6 +1416,7 @@ static int imx_uart_dma_init(struct imx_port *sport) > return ret; > } > =20 > +/* called with port.lock taken and irqs off */ > static void imx_uart_enable_dma(struct imx_port *sport) > { > u32 ucr1; >=20 >=20 =2D-=20 TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/