Re: [PATCH v7] serial: support for 16550A serial ports on LP-8x4x

From: One Thousand Gnomes
Date: Tue Mar 01 2016 - 13:44:21 EST


> Maybe you just set a baud rate nearest to the one from the table in
> case of BOTHER?

This is broken. BOTHER can be set with a perfectly valid baud rate that
could equally be represented by B9600 say.

If you are stuck with limited ranges then

switch(baud) {
case 9600:
case 4800:

etc

and don't worry about BOTHER, it's entirely transparent to you. The core
kernel code will provide you with a baud rate number, the re-encoder will
always do the right thing.

A driver should never care about BOTHER or any of the baud bits in the
termios structure directly.

Alan