Thread (2 messages) 2 messages, 2 authors, 2021-05-06

Re: [PATCH 34/35] tty: make tty_get_byte_size available

From: Andy Shevchenko <hidden>
Date: 2021-05-06 09:33:47
Also in: lkml

Possibly related (same subject, not in this thread)

On Thu, May 6, 2021 at 11:31 AM Jiri Slaby [off-list ref] wrote:
On 06. 05. 21, 10:24, Andy Shevchenko wrote:
quoted
if (!account_flags)
   return bits;

?
So I have:

Good to me, feel free to add
Reviewed-by: Andy Shevchenko <redacted>
to this variant.
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


-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help