From patchwork Thu May 25 09:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 98927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp235455vqr; Thu, 25 May 2023 02:43:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4u6fad11LWulHIuGxbIeGvTkv1frv79dZYCADyayA1Mo3v1K4Waj5TRWJQHncMsgma8djP X-Received: by 2002:a17:90a:6b41:b0:255:b1d3:5220 with SMTP id x1-20020a17090a6b4100b00255b1d35220mr1014738pjl.20.1685007780946; Thu, 25 May 2023 02:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685007780; cv=none; d=google.com; s=arc-20160816; b=RGRjYhnXTPtO3KAw7eyJ9B0j9zskWFgh5RiW7Mr91RrNlCSvnFOdSDvn5jqQrOB4y+ ecX660IMiT8ZHQ4P6CGn0PgJEjLocdQjNWg18Vq36wzBhXrHEx0qdDS1NigjS9OYi15q szhuxnGjWWrjqTKfCX5vE6z+IqMUhCIPw/C0NM5h9fz6KOm8PxxskAdXoFEWzBl9m0x/ wDWXxZPLaFlvXTZzn4NKgSW9NxBo+9N+PBuigiK0S6B3AboAl7Zay1UidBo/8vr9LLpG DEkV34et2ff/9Kh5jZKimyxbajpXNP8f+/GCDxxO8x6JLxf1yafP88TYLD9gSs7IbuQI UUaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=4e3/MmglhQzDhzxZKmrh29ltZzGLtHjU6m+4lcF3Ohc=; b=XZmYyt8RB8SfWFjpTxrIP9GlBokSIY3SfVB6rG2QBinorv+Vm8m2LhqIBiBcJpWfNt HlOygyzC0ktglpULAQRdLguD8Gg0ILFXIDFvT+/N/ZQfusojub/5So8BUFZ5GQHb1Apn K1XweF/CPwvdFcEsPEzM65IMWTaPhqFyLUs3pSolIeOAlA7hiBoanI+jUtzykbiiuwB3 7vWpFKTHwJy89mafI4OllMBGUCLrluyeFt4qgKLQtVtOTwrOh1+FlAshd4kL3B8gqp1c KYKCSsCh8pzeDtQxpPTTKzESvxRyDGvp3rZfnKwIOsS1B5NQ6xmK9GvlKylyeksrLmsl +M3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NTr1IkyQ; dkim=neutral (no key) header.i=@linutronix.de header.b="OQ/ky65D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gz24-20020a17090b0ed800b0024e2c5e3a4asi1149052pjb.132.2023.05.25.02.42.46; Thu, 25 May 2023 02:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NTr1IkyQ; dkim=neutral (no key) header.i=@linutronix.de header.b="OQ/ky65D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240681AbjEYJep (ORCPT + 99 others); Thu, 25 May 2023 05:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240519AbjEYJeg (ORCPT ); Thu, 25 May 2023 05:34:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548C71A2; Thu, 25 May 2023 02:34:31 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685007269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4e3/MmglhQzDhzxZKmrh29ltZzGLtHjU6m+4lcF3Ohc=; b=NTr1IkyQZ3OjcNlK4kp6xH1FWtIZitO+012FKXjtrrK1TncJzHvVRCKB2HJMfrJeLNwbdv JqTB4lbCkHpWdmGVU5IV0oSMOrnCgco1IrJYFalyMgIYhkmoF+ls8sWoIXWwGHBTvAv2VM AsESQbtcYDRinZpSMAv2lQTsnptfIbem7K8AtFoGqFwud1/rfvw7F05ZvxvRy0LATu+F8T D+EFAcJK7ms+VnYmR2p2r9Qpx1ZLFq6Z0RTlRc1a0UNByZ9v138z6/F1HL5D3TdYva9DEW wga+ysXcWpNnhcGd/bCi+WRLYUf/VVV3R00jadPPgDtnIqKZbThruZgML7Vlfw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685007269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4e3/MmglhQzDhzxZKmrh29ltZzGLtHjU6m+4lcF3Ohc=; b=OQ/ky65DAwfr8I0FKrHj0L+b/kkpcdBW/cvTc4v+Gja6TPoPnsWTFi/SGx6YP134mMOLhZ Z42apekShbMWanBQ== To: Greg Kroah-Hartman Cc: Petr Mladek , Thomas Gleixner , linux-kernel@vger.kernel.org, Jiri Slaby , Vijaya Krishna Nivarthi , Douglas Anderson , linux-serial@vger.kernel.org Subject: [PATCH tty v1 4/8] serial: core: lock port for start_rx() in uart_resume_port() Date: Thu, 25 May 2023 11:37:55 +0206 Message-Id: <20230525093159.223817-5-john.ogness@linutronix.de> In-Reply-To: <20230525093159.223817-1-john.ogness@linutronix.de> References: <20230525093159.223817-1-john.ogness@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766858719087730823?= X-GMAIL-MSGID: =?utf-8?q?1766858719087730823?= The only user of the start_rx() callback (qcom_geni) directly calls its own stop_rx() callback. Since stop_rx() requires that the port->lock is taken and interrupts are disabled, the start_rx() callback has the same requirement. Fixes: cfab87c2c271 ("serial: core: Introduce callback for start_rx and do stop_rx in suspend only if this callback implementation is present.") Signed-off-by: John Ogness Reviewed-by: Douglas Anderson --- drivers/tty/serial/serial_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 37ad53616372..f856c7fae2fd 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2430,8 +2430,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) if (console_suspend_enabled) uart_change_pm(state, UART_PM_STATE_ON); uport->ops->set_termios(uport, &termios, NULL); - if (!console_suspend_enabled && uport->ops->start_rx) + if (!console_suspend_enabled && uport->ops->start_rx) { + spin_lock_irq(&uport->lock); uport->ops->start_rx(uport); + spin_unlock_irq(&uport->lock); + } if (console_suspend_enabled) console_start(uport->cons); }