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: 626805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2E07C433FE for ; Fri, 18 Nov 2022 14:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242119AbiKRO4m (ORCPT ); Fri, 18 Nov 2022 09:56:42 -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-Google-Smtp-Source: AA0mqf773FaQzqCQVAeuujfyhBorMoO6bjk0T4a61NtOD02BNQTEIp3KPlMF87jK8RGD2j0NauEcBw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 --- 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)); }