[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7830c076-0d42-662c-5baa-2baecf1ad3b0@kernel.org>
Date: Thu, 6 May 2021 10:31:36 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
Joe Perches <joe@...ches.com>
Cc: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 34/35] tty: make tty_get_byte_size available
On 06. 05. 21, 10:24, Andy Shevchenko wrote:
> if (!account_flags)
> return bits;
>
> ?
So I have:
unsigned char tty_get_byte_size(unsigned int cflag, bool account_flags)
{
unsigned char bits;
switch (cflag & CSIZE) {
case CS5:
bits = 5;
break;
case CS6:
bits = 6;
break;
case CS7:
bits = 7;
break;
case CS8:
default:
bits = 8;
break;
}
if (!account_flags)
return bits;
if (cflag & CSTOPB)
bits++;
if (cflag & PARENB)
bits++;
return bits + 2;
}
thanks,
--
js
suse labs
Powered by blists - more mailing lists