From patchwork Fri Nov 18 14:55:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 22375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp239832wrr; Fri, 18 Nov 2022 06:57:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf79L92iPqyrhdxa2Sop4TS3+zdlzoHEIYe9V1y8uEOy5mH5d27l34OEg3MtiqccGpIo1scY X-Received: by 2002:a63:ec46:0:b0:456:5024:e6ae with SMTP id r6-20020a63ec46000000b004565024e6aemr6775859pgj.466.1668783469641; Fri, 18 Nov 2022 06:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668783469; cv=none; d=google.com; s=arc-20160816; b=NWMJ3FWRIi6+ikzH7KGr2iyYImUNRxeMuEbsMdVCVijx2hDxQKHscBdNsx9ncFtEc4 HgDRVwYUDrZoPHdVw28KbibDw1953NIw1ttQce1rCzF818Udz6NutjFo3nLXPpk0tS86 SMcuA4gynPnBKADEVGVJe68NcaW7IPageS2W/Z764scBP4zS0WQIADpg3plZIjY+OJ1q UOGR89xYZ4Z2+CVRFWzzbfbJ1hANqL5nzdeufW1lX6GNiBvj63DoIhn+Mlatx9uiAsfN 4tDdnTzCQSDjDf++DSupOyA5PEdCL7MWjlA1+XmGPa+afwaHPXgxBtyEhOT6qLN+n2C/ Oi+w== 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=I7E1AL+Zmws98336Eqgx5BGd+1bmMfsNL2UgCg2pcHE=; b=gds++B2ZXTcIdDgJvy34lgpc1Y57AZobb+5qel+BMP3rWkAae0FYxsV9m+LN5DrESJ JVqo73CYF2iZGab9X7IdsfJYplqvVh22x6OjH+/BPGxqsAoH1LqZcVc333ECx17hxxsy 8+GV0AyiWaIILnR0+JDeoeQvBktufwlMadBE4RhWG52w+AELumdyyVUC97kPfF4ls4BO /H1X84cGdBOjYEOP4HiJns7Us2UKW1xlIKU1L9cEpVUItoB0bNqrn1exzEgjfXtLx3k0 XVWUPTqfuUZ8LxEC0UGXfe/zWbskEib0sh+REsujgnoBSbzSyZZr8W2/ef2gWXSXE2uY AorA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pJItifKO; 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=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a170902e88b00b00176d347e9aesi4521775plg.366.2022.11.18.06.57.36; Fri, 18 Nov 2022 06:57:49 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=pJItifKO; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242290AbiKRO44 (ORCPT + 99 others); Fri, 18 Nov 2022 09:56:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242083AbiKRO4N (ORCPT ); Fri, 18 Nov 2022 09:56:13 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF47D2B260; Fri, 18 Nov 2022 06:55:33 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id fz10so3243378qtb.3; Fri, 18 Nov 2022 06:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I7E1AL+Zmws98336Eqgx5BGd+1bmMfsNL2UgCg2pcHE=; b=pJItifKORV0QiH4EedBo3e0jCaeBPHJknDLFUbBzxThnTSLNfvepzwhfg1Wgsx5HW6 9zxRC2H5EyiP3t6BzbQQ7TxSAMisT7TFc8IUfHyRpoecD2oJcBVGm0LlsJYkkRf8op/Q 1nLB4ELIBqhJBxd+iq863TcAQTgjMZHDkIkX4r21nmjrjMv/GfmsTD8ziOwvc1/pxRdi bN7qYIpubW9hsKDnm2Fuz/n8MRkWpTRtKBQNuMk+LmyrFkfczdkZCJJI8NBumCaQmgrm f/93Lg99z7fA5ourQ4DrJlGs2dUBw+442MDZM/V/w2c3kfX0Mree3UCXRNtxOTmF3Zu6 gRtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I7E1AL+Zmws98336Eqgx5BGd+1bmMfsNL2UgCg2pcHE=; b=nlRX3GAyWkzBuamVrkJN+iO9d/9ObpZ6dTzOe7X/HfYkb9ktrPXndSlf09PRnQX0To TrljS/gTlq+V8qiG2RxcF5YRJPF680nGI5AJZsgeEfRoyAxAcwRWj4ER9UHj14FgMJBV 9onfZIhPuF2Qi5sfcgaVKbzxKSLTlb3U5ZHP2L4gW7+2oG4tDJRpE4Avw4cam9TES+fx MzxZKpSgop2nCskZmVEQSNk6rEqmedLiDs1f/TsPdDuDLjT+wA986Jpzx5NPu6lG2x8V gJvRj1INnsLBb++ZXaeVjSChpnef36miani/eGquXVBtsaNY4TqXpesjIWYhXaBfnBY9 emOw== X-Gm-Message-State: ANoB5pkXoqzitzWXsBxb6WG1GJRxsjKDRBWUAmUulzHQMYoHYdZgPOQH TgRVqPbD01IMTR7J5BXp7/dPPzOZeXmqVg== X-Received: by 2002:ac8:4906:0:b0:399:7cda:9ad2 with SMTP id e6-20020ac84906000000b003997cda9ad2mr6895973qtq.485.1668783332610; Fri, 18 Nov 2022 06:55:32 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55:32 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v5 10/14] serial: liteuart: separate rx loop from poll timer Date: Fri, 18 Nov 2022 09:55:08 -0500 Message-Id: <20221118145512.509950-11-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-1-gsomlo@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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?1749846295793758122?= X-GMAIL-MSGID: =?utf-8?q?1749846295793758122?= Convert the rx loop into its own dedicated function, and (for now) call it from the poll timer. This is in preparation for adding irq support to the receive path. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen Reviewed-by: Geert Uytterhoeven --- drivers/tty/serial/liteuart.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 42ac9aee050a..76f8a09b82cd 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -68,10 +68,8 @@ static struct uart_driver liteuart_driver = { #endif }; -static void liteuart_timer(struct timer_list *t) +static void liteuart_rx_chars(struct uart_port *port) { - struct liteuart_port *uart = from_timer(uart, t, timer); - struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; unsigned int status, ch; @@ -88,6 +86,14 @@ static void liteuart_timer(struct timer_list *t) } tty_flip_buffer_push(&port->state->port); +} + +static void liteuart_timer(struct timer_list *t) +{ + struct liteuart_port *uart = from_timer(uart, t, timer); + struct uart_port *port = &uart->port; + + liteuart_rx_chars(port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); }