Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp156914lqb; Tue, 16 Apr 2024 11:29:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRkZLsPZGipy4bQq+wKv33wTJ9N/urZpRoFSWtGhpuMEG7tQ7zkm6/qkf+LIEccj4t+7XwniQdHvJRwkeVSyQY2v+PaXCFyQrQOpTwzw== X-Google-Smtp-Source: AGHT+IEX7FDcEO31dwptjZD0VJXJ+lUJEBvRE3Cdiym25L6+PcFbIcO75fuo38dG1NAj5BvTpVd3 X-Received: by 2002:a17:906:1955:b0:a55:33a5:911c with SMTP id b21-20020a170906195500b00a5533a5911cmr3109345eje.25.1713292195582; Tue, 16 Apr 2024 11:29:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713292195; cv=pass; d=google.com; s=arc-20160816; b=yjK4humdO+k7gUfypAe9wW3Rcf3PzR4X5I35yOXH82CS1ygrzMbQZ/f5GcV9nVNSRB mS3+nPK0ZbTbmIAnxjVMYTZJo+dlZG1t6JEW87wzUYTsLsLWWVy6RtazRKXnYNDxYtCa BxlpYBSMIX/7t6DcjOGnKjo56JiWPxcbQxvWBbqLEenbyzossrmgzfv5fVz2M/YE24/U diDK550/9tPdIa2YUHQbG+f9vaC6yUXWD9DtHwFhZZmftcCI5frJfFptiEot/cjlf6BT 4dJGpISHs8zoN4+vsbgFgsXKGfc9zwEoJ+hyBTp9OU+trHKlJ22icwnwfhDS/WbrUMFm MPWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=BIDs04sJtbgfAiuNZcYHHoKZXettnAp939uQ5VQM0HI=; fh=YdUSswXC5mJ2xg94FpOMeF/EMgqf5AA86Gep/RT4GVU=; b=E7e0uISi9YlUF9OngOqgzKjIP8fzNIE+s0yEKVY1+I4h7nStidroAQFMJjGoqVzcIg wAE6pJVzABRtIscXYCgCM6/f/L9DXlTKh9s2PCc8zLtmulsUyqU68hjKugcLtBONx98i uyqheiE00IWXl4QQj7H9EKgCY4uExO1+YvB0GWT7TV17WBXOzkPPa95gHn6Br1FfSclP lFLYbimOzXcH0NoSnBqlvOMZR+MMQXAlxZiAxy4WFT4K1m8W29YFUEn+1nLszrfBsQMo Z/F/SU2KcSJfTmQLdlz9vOJrcw5pFw4gWgS82FrLZmz8qH2Rs+WVUMSVtceK5X54wkNW CaQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b="drMw/duP"; arc=pass (i=1 spf=pass spfdomain=pm.me dkim=pass dkdomain=pm.me dmarc=pass fromdomain=pm.me); spf=pass (google.com: domain of linux-kernel+bounces-147385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qf18-20020a1709077f1200b00a5220b11e4csi6194056ejc.374.2024.04.16.11.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 11:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b="drMw/duP"; arc=pass (i=1 spf=pass spfdomain=pm.me dkim=pass dkdomain=pm.me dmarc=pass fromdomain=pm.me); spf=pass (google.com: domain of linux-kernel+bounces-147385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 495CC1F21DD0 for ; Tue, 16 Apr 2024 18:29:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74FA5136995; Tue, 16 Apr 2024 18:29:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="drMw/duP" Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A64D3135A67 for ; Tue, 16 Apr 2024 18:29:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713292188; cv=none; b=BLZHcy3hC40vOY60lHFZgpDzKrKJQYKI7sYYGXSBiqSJTjjvabHVDp1AtVfxeUR2DppMOyJnzOQJ+ZfVwR0Phdvd+KF9PS3VD6yVbRffS0R/bHpqUcHiV9iKPSRvXy41GXwQn9Euef9rYfmGTdy49lIR4MJE4EVoRD5APBbsQyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713292188; c=relaxed/simple; bh=dOxdME2FokB9hRdd7JjcniyIFSzAQyPzxZ7AzsMbJMg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=etDAuC3NubfusdP6tDMGqAAEhaVqVYVI97xPPvHad1dkjvLoncRUhZ60vEou2z0PcI5kUJeRbeniOIDwdir3ugSRuCB/oAFSO5i6TJIPcsrQr6BZ5LXyfN1fIfBRWWqE6i6g0T+RilWgoskYAkEjsSa3iRRVDxZ+aBRHGC2TXVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=drMw/duP; arc=none smtp.client-ip=185.70.40.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1713292178; x=1713551378; bh=BIDs04sJtbgfAiuNZcYHHoKZXettnAp939uQ5VQM0HI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=drMw/duP6znu7Y72oZiB/i9v4BXv5LGJ1LGuqiNtu8Un+mKz9Hvh7yqtus9C/O/rV 5rIiQc2qWvKxo4Bd5tLuMOTGXvEIskNXTcoRXx9t/jscvzYWtEKpJw3JrtJ1cOQKxg 4ZPms01ZQ67CM9enosRbZhFIV13dyMM2kXJPvUr9W8Bn3phL+t6aCgdGRlLKlAD6PC /uFQs5LuBK4NBqO3NxUP4j61cUU+y1KYMfQ/RcAaCe2nwiQnDPUi8QbyLA4BojZrZ0 UO580tFo+yvHje6+vMKdmxENrIASYQZW2ns8c0t+bEbbcoeVBivSDJcs1k206RX7W7 GXFurFSJ3VFEw== Date: Tue, 16 Apr 2024 18:29:28 +0000 To: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby From: Michael Pratt Cc: Wander Lairson Costa , =?utf-8?Q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko , Vamshi Gajjela , Michael Pratt Subject: [PATCH v2 1/3] serial: core: Store fifo timeout again Message-ID: <20240416182741.22514-2-mcpratt@pm.me> In-Reply-To: <20240416182741.22514-1-mcpratt@pm.me> References: <20240416182741.22514-1-mcpratt@pm.me> Feedback-ID: 27397442:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This is a partial revert of Commit f9008285bb69 ("serial: Drop timeout from uart_port"). In order to prevent having to calculate a timeout for the fifo device during a write operation, if enabled, calculate it ahead of time and store the value of the timeout in a struct member of uart_port. Signed-off-by: Michael Pratt --- V1 -> V2: new commit drivers/tty/serial/serial_core.c | 3 +++ include/linux/serial_core.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index ff85ebd3a007..9b3176d684a4 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -414,6 +414,9 @@ uart_update_timeout(struct uart_port *port, unsigned in= t cflag, =20 =09temp *=3D NSEC_PER_SEC; =09port->frame_time =3D (unsigned int)DIV64_U64_ROUND_UP(temp, baud); + +=09if (port->fifosize > 1) +=09=09port->timeout =3D uart_fifo_timeout(port); } EXPORT_SYMBOL(uart_update_timeout); =20 diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 0a0f6e21d40e..c6422021152f 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -561,6 +561,7 @@ struct uart_port { =20 =09bool=09=09=09hw_stopped;=09=09/* sw-assisted CTS flow state */ =09unsigned int=09=09mctrl;=09=09=09/* current modem ctrl settings */ +=09unsigned long=09=09timeout;=09=09/* character-based timeout */ =09unsigned int=09=09frame_time;=09=09/* frame timing in ns */ =09unsigned int=09=09type;=09=09=09/* port type */ =09const struct uart_ops=09*ops; --=20 2.30.2