[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0/QhJBW1TapqrjC@kroah.com>
Date: Wed, 19 Oct 2022 12:25:08 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: linux-serial@...r.kernel.org, Jiri Slaby <jirislaby@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] tty: Convert tty_buffer flags to bool
On Wed, Oct 19, 2022 at 12:42:39PM +0300, Ilpo Järvinen wrote:
> The struct tty_buffer has flags which is only used for storing TTYB_NORMAL.
> There is also a few quite confusing operations for checking the presense
> of TTYB_NORMAL. Simplify things by converting flags to bool.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
> drivers/tty/tty_buffer.c | 28 ++++++++++++++--------------
> include/linux/tty_buffer.h | 5 +----
> include/linux/tty_flip.h | 4 ++--
> 3 files changed, 17 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> index 5e287dedce01..be3431575a19 100644
> --- a/drivers/tty/tty_buffer.c
> +++ b/drivers/tty/tty_buffer.c
> @@ -107,7 +107,7 @@ static void tty_buffer_reset(struct tty_buffer *p, size_t size)
> p->commit = 0;
> p->lookahead = 0;
> p->read = 0;
> - p->flags = 0;
> + p->flags = true;
> }
>
> /**
> @@ -249,7 +249,7 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld)
> * __tty_buffer_request_room - grow tty buffer if needed
> * @port: tty port
> * @size: size desired
> - * @flags: buffer flags if new buffer allocated (default = 0)
> + * @flags: buffer flags if new buffer allocated
If all this does is store TTYB_NORMAL, why not name it "ttyb_normal"?
Leaving it at "flags" and having that be a boolean is just confusing.
thanks,
greg k-h
Powered by blists - more mailing lists