arch/risc-v/src/mpfs/mpfs_serial.c: Correct setting of nbits

Number of bits was set wrongly in TCSETS for mpfs

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen
2022-01-04 13:21:04 +02:00
committed by Xiang Xiao
parent 6ec006ee02
commit 9aea5d5dbb
+26 -4
View File
@@ -907,11 +907,32 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
priv->stopbits2 = (termiosp->c_cflag & CSTOPB) != 0; priv->stopbits2 = (termiosp->c_cflag & CSTOPB) != 0;
priv->bits = (termiosp->c_cflag & CS5) ? 5 : 0; switch (termiosp->c_cflag & CSIZE)
priv->bits = (termiosp->c_cflag & CS6) ? 6 : 0; {
priv->bits = (termiosp->c_cflag & CS7) ? 7 : 0; case CS5:
priv->bits = (termiosp->c_cflag & CS8) ? 8 : 0; priv->bits = 5;
break;
case CS6:
priv->bits = 6;
break;
case CS7:
priv->bits = 7;
break;
case CS8:
priv->bits = 8;
break;
default:
priv->bits = 0;
ret = -EINVAL;
break;
}
if (ret == OK)
{
/* Note that only cfgetispeed is used because we have knowledge /* Note that only cfgetispeed is used because we have knowledge
* that only one speed is supported. * that only one speed is supported.
*/ */
@@ -924,6 +945,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
up_set_format(dev); up_set_format(dev);
} }
}
break; break;
#endif /* CONFIG_SERIAL_TERMIOS */ #endif /* CONFIG_SERIAL_TERMIOS */