From patchwork Tue Aug 22 03:57:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1823853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=lxfoeDhG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RVFtd49wmz1yg4 for ; Tue, 22 Aug 2023 13:58:00 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qYIWb-0008QQ-I5; Tue, 22 Aug 2023 03:57:49 +0000 Received: from mail-pf1-f176.google.com ([209.85.210.176]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qYIWZ-0008Q4-PH for kernel-team@lists.ubuntu.com; Tue, 22 Aug 2023 03:57:47 +0000 Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-686be3cbea0so3378749b3a.0 for ; Mon, 21 Aug 2023 20:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692676666; x=1693281466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=9DU4kfqORfgBbxJAVDUvf+/f0FkEVQJMzthLAbHVFRY=; b=lxfoeDhGq32xgJJWO25MZCWTHozBFh/Pu4GmrfMesBvwymsUnrrZghgRNk1N1Z6eGN m1se0o0sXJXyYdpJQweZrmLCiTkQxGs7R5mJ0veZkkLe+wbVJTLjnzkWsaHemy357FR9 UqmNG2E8r5Wx93jtonROZru+n/WBif2uNlQln9Y0/UvIVgrMgymhmGNzYbN/KWEGfCmo nFlHZkvJZEI01CV+f50DtUoikdal5out+DxeRoKZqjRDtm9QvgkPNYcRndFm9CIIJBww EOftNoGQJIs1Av6rOAWEFZdGQJX3RhkOuYATs+bKN32yUalqfdLcSwMhJ7BZ8EmhAAQg /kWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692676666; x=1693281466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9DU4kfqORfgBbxJAVDUvf+/f0FkEVQJMzthLAbHVFRY=; b=gJ3n+t0QmbKhcGvJbtbGyaEugsStPbqG97RNC/ZSnBh3UnCiK6CWV4dguJSThbn6XZ IZwoq2q7wMZblFGjQxiE0KGpVm55Sdj6CItU6qSilUkKyQ3v+X7TnSvJLNwtG2Zc673m cUyGwpBmgQydwlguBozzWy/qC/heyN0u8xt3H5ba8Ja9PQnrrZMPD42pelF81CKUhZaP x61BCHdPC5+Y0hWyKKZUO69qnokdZE/SLODejY5V1AYlB5kgmVXoGucv5xhIxgiFNYxi SMB5Zg/isJ1+up8qmHQhHjG+3UznoujYUP36C2z6fobH1AYhQAauw2wvkeIdlRfXC2j9 iFvA== X-Gm-Message-State: AOJu0YzBDalsCoJ3Zt8AUQW0caqdqSWWJiou8ken1r+NeiXYCDWWE4Bk 7sPWj9ziH5UVazj8Fltl/vZzNjXyPNuiiQ== X-Google-Smtp-Source: AGHT+IHShsEQ5PjXXluRxVlK+HJzOMGxX/A5+GGtKl9B0LNJN0ngqmYKVsI/GC9F+qg39HWZrjyvQg== X-Received: by 2002:a05:6a21:6da5:b0:123:152d:d46b with SMTP id wl37-20020a056a216da500b00123152dd46bmr11671466pzb.26.1692676665739; Mon, 21 Aug 2023 20:57:45 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id i22-20020aa79096000000b0068a0c403636sm4755547pfa.192.2023.08.21.20.57.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 20:57:45 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][M][Unstable] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: replace chars_in_buffer() with flush_chars() Date: Tue, 22 Aug 2023 11:57:40 +0800 Message-Id: <20230822035740.277523-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822035740.277523-1-acelan.kao@canonical.com> References: <20230822035740.277523-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.176; envelope-from=acelan@gmail.com; helo=mail-pf1-f176.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Chia-Lin Kao (AceLan)" BugLink: https://bugs.launchpad.net/bugs/2032174 After v6.5, calls tty->driver->ops->chars_in_buffer() may lead to a deadlock and got soft lockup error. Try using tty->driver->ops->flush_chars() to archive to same scenario. There is no functional change, even if uart_flush_chars() doesn't do what we expected, the driver should be able to keep working, as the backlight commands is only 3 or 4 bytes short and has little chance to stay in the queue partially. Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/platform/x86/dell/dell-uart-backlight.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/platform/x86/dell/dell-uart-backlight.c index 3f8ea639d557..120701e5b8b1 100644 --- a/drivers/platform/x86/dell/dell-uart-backlight.c +++ b/drivers/platform/x86/dell/dell-uart-backlight.c @@ -39,7 +39,8 @@ static struct file *ftty; unsigned int (*io_serial_in)(struct uart_port *p, int offset); int (*uart_write)(struct tty_struct *tty, const unsigned char *buf, int count); -unsigned int (*uart_chars_in_buffer)(struct tty_struct *tty); +void (*uart_flush_chars)(struct tty_struct *tty); + static bool force; module_param(force, bool, 0444); @@ -160,8 +161,7 @@ static int dell_uart_write(struct uart_8250_port *up, __u8 *buf, int len) tty_port_tty_wakeup(&port->state->port); tty = tty_port_tty_get(&port->state->port); actual = uart_write(tty, buf, len); - while (uart_chars_in_buffer(tty)) - udelay(10); + uart_flush_chars(tty); return actual; } @@ -401,7 +401,7 @@ static int dell_uart_startup(struct dell_uart_backlight *dell_pdata) tty = port->state->port.tty; io_serial_in = port->serial_in; uart_write = tty->driver->ops->write; - uart_chars_in_buffer = tty->driver->ops->chars_in_buffer; + uart_flush_chars = tty->driver->ops->flush_chars; return 0; }