提交 7a3525e4 编写于 作者: I Ilpo Järvinen 提交者: Greg Kroah-Hartman

serial: 8250: Adjust misleading LSR related comment

serial8250_rx_chars() has max_count based character limit. If it
triggers, the function returns the old LSR value (and it has never
returned only flags which were not handled). Adjust the comment to
match behavior and warn about which flags can be depended on.

I'd have moved LSR read before LSR read and used serial_lsr_in() also
here but I came across an old discussion about the topic. That
discussion generated commit d22f8f10 ("serial: 8250: Fix lost rx
state") so I left the code as it is (it works as long as the callers
only use a subset of the LSR flags which holds true today) and changed
the comment instead.

Link: https://www.spinics.net/lists/linux-serial/msg16220.htmlReviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: NIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220608095431.18376-5-ilpo.jarvinen@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6a4241e8
......@@ -1783,9 +1783,11 @@ void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr)
EXPORT_SYMBOL_GPL(serial8250_read_char);
/*
* serial8250_rx_chars: processes according to the passed in LSR
* value, and returns the remaining LSR bits not handled
* by this Rx routine.
* serial8250_rx_chars - Read characters. The first LSR value must be passed in.
*
* Returns LSR bits. The caller should rely only on non-Rx related LSR bits
* (such as THRE) because the LSR value might come from an already consumed
* character.
*/
unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册