linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial <linux-serial@vger.kernel.org>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Paul Cercueil" <paul@crapouillou.net>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mips@vger.kernel.org,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lukas Wunner" <lukas.wunner@intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH v6 1/6] serial: 8250: make saved LSR larger
Date: Mon, 13 Jun 2022 12:25:24 +0300 (EEST)	[thread overview]
Message-ID: <cd812b3-393-79be-d7bf-ce79376d9f@linux.intel.com> (raw)
In-Reply-To: <670010a1-7727-f2d9-87ad-18ddbeb0cbef@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

On Mon, 13 Jun 2022, Jiri Slaby wrote:

> On 13. 06. 22, 9:52, Ilpo Järvinen wrote:
> > DW flags address received as BIT(8) in LSR. In order to not lose that
> > on read, enlarge lsr_saved_flags to u16.
> > 
> > Adjust lsr/status variables and related call chains which used unsigned
> > char type previously to unsigned int. Technically, some of these type
> > conversion would not be needed but it doesn't hurt to be consistent.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ...
> > --- a/include/linux/serial_8250.h
> > +++ b/include/linux/serial_8250.h
> > @@ -119,7 +119,7 @@ struct uart_8250_port {
> >   	 * be immediately processed.
> >   	 */
> >   #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
> > -	unsigned char		lsr_saved_flags;
> > +	u16			lsr_saved_flags;
> >   #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
> >   	unsigned char		msr_saved_flags;
> >   @@ -170,8 +170,8 @@ extern void serial8250_do_set_divisor(struct uart_port
> > *port, unsigned int baud,
> >   				      unsigned int quot_frac);
> >   extern int fsl8250_handle_irq(struct uart_port *port);
> >   int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
> > -unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char
> > lsr);
> > -void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr);
> > +unsigned int serial8250_rx_chars(struct uart_8250_port *up, unsigned int
> > lsr);
> > +void serial8250_read_char(struct uart_8250_port *up, unsigned int lsr);
> 
> It looks odd to have
>   u16 lsr_saved_flags
> in the struct and
>   unsigned int lsr
> here and there. You wrote:
>   Technically, some of these type conversion would not be needed
>   but it doesn't hurt to be consistent
> But it looks like you actually made them a bit inconsistent.

Those were actually meant to discuss on different things. u16 is the 
oldest part of change and the reason why it is only u16 is that I
didn't need more than that to store the bits used for the mask.

That "consistent" part was written to note that there are case which check 
only e.g. TEMT flag. As TEMT is within first 8 bits, it doesn't absolutely 
need more than unsigned char but I enlarged those types regardless.
I agree with you though the wording doesn't convey meaning exclusive to 
those cases.

> So why not use u16 for everyone?

If that consistency is necessary, I'd be more inclined to make the ones in 
the uart_8250_port unsigned int instead. The reason is that it would then 
align better to read/ignore_status_mask that are already unsigned int. 
Would it be ok or do you still prefer u16?

-- 
 i.

      reply	other threads:[~2022-06-13  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220613075227.10394-1-ilpo.jarvinen@linux.intel.com>
2022-06-13  7:52 ` [PATCH v6 1/6] serial: 8250: make saved LSR larger Ilpo Järvinen
2022-06-13  8:26   ` Jiri Slaby
2022-06-13  9:25     ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd812b3-393-79be-d7bf-ce79376d9f@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas.wunner@intel.com \
    --cc=paul@crapouillou.net \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).