Message ID | 20221118145512.509950-10-gsomlo@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp240493wrr; Fri, 18 Nov 2022 06:59:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gFg2R9Bav33KbKHNuUscN1dndARJnZ2Kc8HKj8UUxTSrtFhmdLYkDjDaLopgY9CHH7xjS X-Received: by 2002:a17:907:11c5:b0:7b1:316c:38f7 with SMTP id va5-20020a17090711c500b007b1316c38f7mr6389224ejb.387.1668783559905; Fri, 18 Nov 2022 06:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668783559; cv=none; d=google.com; s=arc-20160816; b=kGkfCaG4HqUpWBl2TeJ/EZOOWx1zdqwz06AqcLNgpdR1gFJJ32H3NKgnp3+K+6aleq k9bAhZ/ulBEGz91/X5KWtOjtbPeZ4od9KAGh40BjjRiapubijiOFLrdylNXuYGOzLs+l xP+ulbMiEXkTWSf1b9+xJ+6D5DC64Fkr8pZFHS/lKmT4UN6KiC35b5X3gwzn7rRyvOzS vmtrP1cssg8gdQYqZgmpsKTAxEmlj9hKWNJFwIrCp98JY7Ege861PtU2II6+vInMMvvh XYGdLb7RWP2V2qJBCOk1CKkvez7xx8cTz1GHp+BBy4B9w/CnsWFWIMJ7B+Ek75elbrXg uiDA== 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=AUJ4wmyHldmie0gv1i5ed1iRJzoHABMpIHKKor6rIMU=; b=Me2yuizWF9FcL2II4PyQT9Xk12rhiaUCaK8bcKEFrBTvYEwoEjZV4CLGWjmlJPeijP 6lTehs3XlGiU94uJGUZkqJwqlLAcwWdIvVWswzGFBs5zmYbf8E0vRr67AMZRLFCkAsAz feeV6NiVJjB2N/OvQWrxTTqNR4rUy0vggqadFlVSYmUFipwposmW5dnHCiehUknsfPA0 1YiL42bT9SUxeQuQCm2EfPQRFHf0EP/7so4JOIiJIBkGsAQLnP0OUY0/o3ef/C+SJPoG Tbv5A775TQalR9bNO+loMz6hh8e903wvQBizrwhK0S0xE1EuzbIjdcb42HlmD23yzHcv mE2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RVtZ+axm; 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 l9-20020a170906794900b0079ddb52369bsi3428466ejo.61.2022.11.18.06.58.55; Fri, 18 Nov 2022 06:59:19 -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=RVtZ+axm; 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 S242227AbiKRO4r (ORCPT <rfc822;kkmonlee@gmail.com> + 99 others); Fri, 18 Nov 2022 09:56:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242049AbiKROzz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 18 Nov 2022 09:55:55 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A508FF87; Fri, 18 Nov 2022 06:55:32 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id w4so3275473qts.0; Fri, 18 Nov 2022 06:55:32 -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=AUJ4wmyHldmie0gv1i5ed1iRJzoHABMpIHKKor6rIMU=; b=RVtZ+axm8f/78K4x9m6u9WdDEV/snwwvJz9dYQG56lAmbBWPx8E4OQHsw/xQfItmKZ WCdx3EAm1/TT9laCmVqYWGZv5dx7k0lYgww8spab9/GZeVMoiJf0Fn0csTzulhP16PHI WSppyPBpE1gAy0xNBzEMkJQ4mHU7tUn0qVfNfkbq3yE0c/uqDJYdLUdScMzNijAG+ttS AXaliMknQ+wUHZrtE2ABhkI5zqHhwRdFXUy9sOOpN/4Xv/kQgpFpbTu24xWfzULaMJmY J0Xd92IBfQeBdRYW+iLb1C/lpL516CHqqsE9iNLb9RbmoPjPR5yZhAUT7gZoazlgM167 wC0A== 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=AUJ4wmyHldmie0gv1i5ed1iRJzoHABMpIHKKor6rIMU=; b=RpSSbugdosshtImb8DhvbLYyKmcJFgVGn4Iek1LWPiCvpb2FzLUro4npvD/L6o0Hnw E5D85VnDbJEs+nV1W/Uw6v7YndP3D04IYWUqgNSQrFKq5HXJieoNfqNDdbkwpSFpdQzr WAvjN1A0PXkQhhzW7m/h8HHfOdkpyyyCcG49mxKYJr+7aGONrzw3+Jo9fCufsTgmyqFi Oyo6+4x3GodM7PxY0BRuW5e5Z38gx5GtjZqEDBzW8++YTKV986TOEXdgBt1yFPo0GMfv bdQVVMob5GF1zA4Z/4mx82Ee79JKLzZVXuJIgvTyj6XwTmWHTYgeTWRsGGv4/rKxDE1h Fzww== X-Gm-Message-State: ANoB5pmxTsj308MWLIFABheZTD7l3+JQC9XlnY5J3W94nSpDT6DJGklV y6HN04J2/jFgbrU5gmHvqdnAdyjKK1w9fg== X-Received: by 2002:ac8:6701:0:b0:3a5:280a:3c9b with SMTP id e1-20020ac86701000000b003a5280a3c9bmr6922441qtp.8.1668783331173; Fri, 18 Nov 2022 06:55:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55:30 -0800 (PST) From: Gabriel Somlo <gsomlo@gmail.com> 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 09/14] serial: liteuart: fix rx loop variable types Date: Fri, 18 Nov 2022 09:55:07 -0500 Message-Id: <20221118145512.509950-10-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749846390088659502?= X-GMAIL-MSGID: =?utf-8?q?1749846390088659502?= |
Series |
serial: liteuart: add IRQ support
|
|
Commit Message
Gabriel L. Somlo
Nov. 18, 2022, 2:55 p.m. UTC
Update variable types to match the signature of uart_insert_char() which consumes them. Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> --- drivers/tty/serial/liteuart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 18. 11. 22, 15:55, Gabriel Somlo wrote: > Update variable types to match the signature of uart_insert_char() > which consumes them. > > Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > --- > drivers/tty/serial/liteuart.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c > index 81aa7c1da73c..42ac9aee050a 100644 > --- a/drivers/tty/serial/liteuart.c > +++ b/drivers/tty/serial/liteuart.c > @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) > struct liteuart_port *uart = from_timer(uart, t, timer); > struct uart_port *port = &uart->port; > unsigned char __iomem *membase = port->membase; > - int ch; > - unsigned long status; > + unsigned int status, ch; These should be u8 after all, right? Wait, status is a bool in the end: > while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) { But why is it passed to uart_insert_char() as such? That's ugly. Maybe drop all of this "status" and pass LSR_RXC directly. The while's condition would simply look like (!litex_read8(membase + OFF_RXEMPTY)) then. > ch = litex_read8(membase + OFF_RXTX); thanks,
On 21. 11. 22, 9:37, Jiri Slaby wrote: > On 18. 11. 22, 15:55, Gabriel Somlo wrote: >> Update variable types to match the signature of uart_insert_char() >> which consumes them. >> >> Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> >> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> >> --- >> drivers/tty/serial/liteuart.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/tty/serial/liteuart.c >> b/drivers/tty/serial/liteuart.c >> index 81aa7c1da73c..42ac9aee050a 100644 >> --- a/drivers/tty/serial/liteuart.c >> +++ b/drivers/tty/serial/liteuart.c >> @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) >> struct liteuart_port *uart = from_timer(uart, t, timer); >> struct uart_port *port = &uart->port; >> unsigned char __iomem *membase = port->membase; >> - int ch; >> - unsigned long status; >> + unsigned int status, ch; > > These should be u8 after all, right? > > Wait, status is a bool in the end: > >> while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) { > > But why is it passed to uart_insert_char() as such? That's ugly. Maybe > drop all of this "status" and pass LSR_RXC directly. Actually, even 0 directly, provided overrun parameter is always 0. > The while's > condition would simply look like (!litex_read8(membase + OFF_RXEMPTY)) > then. > >> ch = litex_read8(membase + OFF_RXTX); > > thanks,
On 21. 11. 22, 9:37, Jiri Slaby wrote: > On 18. 11. 22, 15:55, Gabriel Somlo wrote: >> Update variable types to match the signature of uart_insert_char() >> which consumes them. >> >> Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> >> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> >> --- >> drivers/tty/serial/liteuart.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/tty/serial/liteuart.c >> b/drivers/tty/serial/liteuart.c >> index 81aa7c1da73c..42ac9aee050a 100644 >> --- a/drivers/tty/serial/liteuart.c >> +++ b/drivers/tty/serial/liteuart.c >> @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) >> struct liteuart_port *uart = from_timer(uart, t, timer); >> struct uart_port *port = &uart->port; >> unsigned char __iomem *membase = port->membase; >> - int ch; >> - unsigned long status; >> + unsigned int status, ch; > > These should be u8 after all, right? And can you change membase to u8 * too 8-)?
Hi Jiri, Thanks for the feedback! On Mon, Nov 21, 2022 at 09:45:05AM +0100, Jiri Slaby wrote: > On 21. 11. 22, 9:37, Jiri Slaby wrote: > > On 18. 11. 22, 15:55, Gabriel Somlo wrote: > > > Update variable types to match the signature of uart_insert_char() > > > which consumes them. > > > > > > Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> > > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > > --- > > > drivers/tty/serial/liteuart.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/drivers/tty/serial/liteuart.c > > > b/drivers/tty/serial/liteuart.c > > > index 81aa7c1da73c..42ac9aee050a 100644 > > > --- a/drivers/tty/serial/liteuart.c > > > +++ b/drivers/tty/serial/liteuart.c > > > @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) > > > struct liteuart_port *uart = from_timer(uart, t, timer); > > > struct uart_port *port = &uart->port; > > > unsigned char __iomem *membase = port->membase; > > > - int ch; > > > - unsigned long status; > > > + unsigned int status, ch; > > > > These should be u8 after all, right? OK, so: - I can hard-code `status` as `1`, like so: while(!litex_read8(membase + OFF_RXEMPTY) { ... if (!(uart_handle_sysrq_char(port, ch))) uart_insert_char(port, 1, 0, ch, TTY_NORMAL); ... since `status` would always be `1` inside the loop. So I'm basically going to get rid of it altogether. - `ch` is indeed *produced* by `litex_read8()`, which would make it `u8`. It is subsequently *consumed* by `uart_handle_sysrq_char()` and `uart_insert_char()`, which both expect `unsigned int`. If you think it's better to go with the type when the value is produced (as opposed to when it's consumed), I'm OK with that for the upcoming v6 of the series... :) > And can you change membase to u8 * too 8-)? Hmmm, in `struct uart_port` (in include/linux/serial_core.h), the `membase` field is declared as: unsigned char __iomem *membase; which is why I'm thinking we should leave it as-is? Unless there are plans (or a pending patch I'm unaware of) to switch the field in include/linux/serial_core.h to `u8` as well? -- Please advise. Thanks again, --Gabriel > -- > js > suse labs >
On 21. 11. 22, 14:55, Gabriel L. Somlo wrote: > Hi Jiri, > > Thanks for the feedback! > > On Mon, Nov 21, 2022 at 09:45:05AM +0100, Jiri Slaby wrote: >> On 21. 11. 22, 9:37, Jiri Slaby wrote: >>> On 18. 11. 22, 15:55, Gabriel Somlo wrote: >>>> Update variable types to match the signature of uart_insert_char() >>>> which consumes them. >>>> >>>> Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> >>>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> >>>> --- >>>> drivers/tty/serial/liteuart.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/tty/serial/liteuart.c >>>> b/drivers/tty/serial/liteuart.c >>>> index 81aa7c1da73c..42ac9aee050a 100644 >>>> --- a/drivers/tty/serial/liteuart.c >>>> +++ b/drivers/tty/serial/liteuart.c >>>> @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) >>>> struct liteuart_port *uart = from_timer(uart, t, timer); >>>> struct uart_port *port = &uart->port; >>>> unsigned char __iomem *membase = port->membase; >>>> - int ch; >>>> - unsigned long status; >>>> + unsigned int status, ch; >>> >>> These should be u8 after all, right? > > OK, so: > > - I can hard-code `status` as `1`, like so: > > while(!litex_read8(membase + OFF_RXEMPTY) { > ... > if (!(uart_handle_sysrq_char(port, ch))) > uart_insert_char(port, 1, 0, ch, TTY_NORMAL); > > ... since `status` would always be `1` inside the loop. So I'm > basically going to get rid of it altogether. Yes, I had that in my mind. Except passing 1 to uart_insert_char() when overflow is hardwired to 0 makes no sense IMO :). > - `ch` is indeed *produced* by `litex_read8()`, which would make it > `u8`. It is subsequently *consumed* by `uart_handle_sysrq_char()` > and `uart_insert_char()`, which both expect `unsigned int`. Ignore uart_handle_sysrq_char and uart_insert_char. They should be fixed one day. It should really be u8. All down the call chain (it magically turns into int in the sysrq handlers, then char is expected). > If you think it's better to go with the type when the value is > produced (as opposed to when it's consumed), I'm OK with that for > the upcoming v6 of the series... :) Yes, please. We should slowly convert _all_ of them. >> And can you change membase to u8 * too 8-)? > > Hmmm, in `struct uart_port` (in include/linux/serial_core.h), the > `membase` field is declared as: > > unsigned char __iomem *membase; > > which is why I'm thinking we should leave it as-is? Unless there are > plans (or a pending patch I'm unaware of) to switch the field in > include/linux/serial_core.h to `u8` as well? -- Please advise. Ah, then keep it. I somehow thought it's void *. And yes, even this should be u8 __iomem *, eventually. thanks,
On Tue, Nov 22, 2022 at 08:37:58AM +0100, Jiri Slaby wrote: > On 21. 11. 22, 14:55, Gabriel L. Somlo wrote: > > Hi Jiri, > > > > Thanks for the feedback! > > > > On Mon, Nov 21, 2022 at 09:45:05AM +0100, Jiri Slaby wrote: > > > On 21. 11. 22, 9:37, Jiri Slaby wrote: > > > > On 18. 11. 22, 15:55, Gabriel Somlo wrote: > > > > > Update variable types to match the signature of uart_insert_char() > > > > > which consumes them. > > > > > > > > > > Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> > > > > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > > > > --- > > > > > drivers/tty/serial/liteuart.c | 3 +-- > > > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > > > > > diff --git a/drivers/tty/serial/liteuart.c > > > > > b/drivers/tty/serial/liteuart.c > > > > > index 81aa7c1da73c..42ac9aee050a 100644 > > > > > --- a/drivers/tty/serial/liteuart.c > > > > > +++ b/drivers/tty/serial/liteuart.c > > > > > @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) > > > > > struct liteuart_port *uart = from_timer(uart, t, timer); > > > > > struct uart_port *port = &uart->port; > > > > > unsigned char __iomem *membase = port->membase; > > > > > - int ch; > > > > > - unsigned long status; > > > > > + unsigned int status, ch; > > > > > > > > These should be u8 after all, right? > > > > OK, so: > > > > - I can hard-code `status` as `1`, like so: > > > > while(!litex_read8(membase + OFF_RXEMPTY) { > > ... > > if (!(uart_handle_sysrq_char(port, ch))) > > uart_insert_char(port, 1, 0, ch, TTY_NORMAL); > > > > ... since `status` would always be `1` inside the loop. So I'm > > basically going to get rid of it altogether. > > Yes, I had that in my mind. Except passing 1 to uart_insert_char() when > overflow is hardwired to 0 makes no sense IMO :). So, looking at what uart_insert_char() does, I could simply do this instead: while(!litex_read8(membase + OFF_RXEMPTY) { ... /* LiteUART does not provide overrun bits */ if (!(uart_handle_sysrq_char(port, ch) || tty_insert_flip_char(&port->state->port, ch, TTY_NORMAL))) ++port->icount.buf_overrun; That is, `tty_insert_flip_char() is the portion of `uart_insert_char()` that actually gets executed if status is 1 and overrun is 0... I'm not quite confident about whether this is an improvement in legibility and/or code quality, but please let me know what *you* think... :) > > - `ch` is indeed *produced* by `litex_read8()`, which would make it > > `u8`. It is subsequently *consumed* by `uart_handle_sysrq_char()` > > and `uart_insert_char()`, which both expect `unsigned int`. > > Ignore uart_handle_sysrq_char and uart_insert_char. They should be fixed one > day. It should really be u8. All down the call chain (it magically turns > into int in the sysrq handlers, then char is expected). > > > If you think it's better to go with the type when the value is > > produced (as opposed to when it's consumed), I'm OK with that for > > the upcoming v6 of the series... :) > > Yes, please. We should slowly convert _all_ of them. OK, u8 it is, then. > > > And can you change membase to u8 * too 8-)? > > > > Hmmm, in `struct uart_port` (in include/linux/serial_core.h), the > > `membase` field is declared as: > > > > unsigned char __iomem *membase; > > > > which is why I'm thinking we should leave it as-is? Unless there are > > plans (or a pending patch I'm unaware of) to switch the field in > > include/linux/serial_core.h to `u8` as well? -- Please advise. > > Ah, then keep it. I somehow thought it's void *. And yes, even this should > be u8 __iomem *, eventually. OK, it should/will get updated in bulk once that change is made across the entire subsystem, leaving as-is for now. Thanks again for all your help and advice! --Gabriel
On 22. 11. 22, 22:05, Gabriel L. Somlo wrote: > So, looking at what uart_insert_char() does, I could simply do this > instead: > > while(!litex_read8(membase + OFF_RXEMPTY) { > ... > /* LiteUART does not provide overrun bits */ > if (!(uart_handle_sysrq_char(port, ch) || > tty_insert_flip_char(&port->state->port, ch, TTY_NORMAL))) > ++port->icount.buf_overrun; > > That is, `tty_insert_flip_char() is the portion of `uart_insert_char()` > that actually gets executed if status is 1 and overrun is 0... > > I'm not quite confident about whether this is an improvement in legibility > and/or code quality, It's not :). Keep the uart_ helper.
diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 81aa7c1da73c..42ac9aee050a 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) struct liteuart_port *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; - int ch; - unsigned long status; + unsigned int status, ch; while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) { ch = litex_read8(membase + OFF_RXTX);