Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4514291pxj; Wed, 12 May 2021 07:16:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5o155oABYPyT2mKeCPpXsunyP57OR5Pn4A07Scrr4zBHQYI5RB55j+7SNFpZGX7qjOU1z X-Received: by 2002:a05:6402:1547:: with SMTP id p7mr43949943edx.319.1620828985548; Wed, 12 May 2021 07:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620828985; cv=none; d=google.com; s=arc-20160816; b=ofCD7V1q16puhJJk+7nOfQc5RzpEpm6f53h36/4YMdZxDGl1qpOGOjQ5+43eKBrvD6 IJX3o4Bh1sUmroZ6kOOn5w3Gq1QrReR3Z1Zi9Xfbv0hKTyr3bvo0Ab+8VTm+BlgAa9S4 7/YolW13dc97aeiftMfQHfa+flbaadE+tLGF0I6EmjhJMRz9/T3GkIayB8o605YWmoXr Dcou2nU7xbG39QgZ+8/+Mcr4yfIXY/m6Uo2VmzAZHlUdHG6qEGgcdBGOqLZCNqzeort/ 5XhOSCNqfhkf+O6c+HGzninISRVvfgMO4PUSN5KD3wqo8nQeZZ//eS0SJJnkrJSCDk53 odiw== 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:from :dkim-signature; bh=BDfS9iCyKAFrAsK6pAO+znRKWWaSL3SBcDzUWtD8J58=; b=IQL098c0nUFeaF5iNoa2mzQyqHONP+2tv8Ub7nQAhzk/98EKZLbU/nyiaL2zfwsJdk tiw4hFnNoBWRUrKpgBJUuEofMHS49whl/GS80Vo8tQVoKZzmh0707zGoW0fSYG7QPCqu IoCJNN3OdY3NFffipreBPAJeY7m9ArBod9mWdRw7VAJZezChXcPH1I7oN6vMD1hXgy5A n2b5W+gp9egfRTYN82sxbyzXL3su4yAivkB12vHL+Q9HSsN/B4iTxhlvrMJeQ04L1XjV Xi9/Kr1JsnoLa98xq4i4Jij6n670nxihj13Q29IAhaqg4w28vBU1cGnTBix+J5RoR2bN xhIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=v7bOCUrl; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cr15si19196ejc.676.2021.05.12.07.16.00; Wed, 12 May 2021 07:16:25 -0700 (PDT) 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=@walle.cc header.s=mail2016061301 header.b=v7bOCUrl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbhELOO5 (ORCPT + 99 others); Wed, 12 May 2021 10:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231428AbhELOOR (ORCPT ); Wed, 12 May 2021 10:14:17 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D88DDC06174A; Wed, 12 May 2021 07:13:08 -0700 (PDT) Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id E518E22264; Wed, 12 May 2021 16:13:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1620828787; 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=BDfS9iCyKAFrAsK6pAO+znRKWWaSL3SBcDzUWtD8J58=; b=v7bOCUrlG+xN7JHcoh5eqF4LnE8uc7upVZtji2f4TJSvpgVAEW0/A+SGh6Xjg9yU/+Oyok OBf9BytCGrLoR20O4S/5iB4Q0PinP/uON0CLwa5oBQ5gg4Rcobt6EU5vVfCNDuoZY4/oJF /b4xIY6gn5RKvwtx2yOn4q8XpCqiDfs= From: Michael Walle To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Angelo Dureghello , Johan Hovold , Philippe Schenker , Michael Walle Subject: [PATCH v2 4/9] serial: fsl_lpuart: split sysrq handling Date: Wed, 12 May 2021 16:12:50 +0200 Message-Id: <20210512141255.18277-5-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210512141255.18277-1-michael@walle.cc> References: <20210512141255.18277-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of uart_handle_sysrq_char() use uart_prepare_sysrq_char() and uart_unlock_and_check_sysrq(). This will call handle_sysrq() without holding the port lock, which in turn let us drop the spin_trylock hack. Suggested-by: Johan Hovold Signed-off-by: Michael Walle --- drivers/tty/serial/fsl_lpuart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 37e02d992c0b..63a1dac7c3aa 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -847,7 +847,7 @@ static void lpuart_rxint(struct lpuart_port *sport) sr = readb(sport->port.membase + UARTSR1); rx = readb(sport->port.membase + UARTDR); - if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) + if (uart_prepare_sysrq_char(&sport->port, rx)) continue; if (sr & (UARTSR1_PE | UARTSR1_OR | UARTSR1_FE)) { @@ -893,7 +893,7 @@ static void lpuart_rxint(struct lpuart_port *sport) writeb(UARTSFIFO_RXOF, sport->port.membase + UARTSFIFO); } - spin_unlock(&sport->port.lock); + uart_unlock_and_check_sysrq(&sport->port); tty_flip_buffer_push(port); } @@ -924,7 +924,7 @@ static void lpuart32_rxint(struct lpuart_port *sport) rx = lpuart32_read(&sport->port, UARTDATA); rx &= UARTDATA_MASK; - if (uart_handle_sysrq_char(&sport->port, rx)) + if (uart_prepare_sysrq_char(&sport->port, rx)) continue; if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { @@ -959,7 +959,7 @@ static void lpuart32_rxint(struct lpuart_port *sport) } out: - spin_unlock(&sport->port.lock); + uart_unlock_and_check_sysrq(&sport->port); tty_flip_buffer_push(port); } @@ -2272,7 +2272,7 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) unsigned long flags; int locked = 1; - if (sport->port.sysrq || oops_in_progress) + if (oops_in_progress) locked = spin_trylock_irqsave(&sport->port.lock, flags); else spin_lock_irqsave(&sport->port.lock, flags); @@ -2302,7 +2302,7 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count) unsigned long flags; int locked = 1; - if (sport->port.sysrq || oops_in_progress) + if (oops_in_progress) locked = spin_trylock_irqsave(&sport->port.lock, flags); else spin_lock_irqsave(&sport->port.lock, flags); -- 2.20.1