[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] xen/arm: Add i.MX lpuart driver



Hi Peng,

On 18/03/2022 05:23, Peng Fan wrote:
Subject: Re: [PATCH 1/3] xen/arm: Add i.MX lpuart driver
On 28/02/2022 01:07, Peng Fan (OSS) wrote:
From: Peng Fan <peng.fan@xxxxxxx>
+
+    imx_lpuart_write(uart, UARTDATA, c); }
+
+static int imx_lpuart_getc(struct serial_port *port, char *pc) {
+    struct imx_lpuart *uart = port->uart;
+    int ch;
+
+    while ( !(imx_lpuart_read(uart, UARTSTAT) & UARTSTAT_RDRF))
+        barrier();

Same remark about the barrier.

However, rather than waiting, shouldn't we check the watermark instead and
return 0 if there are no character to read?

We normally check status bit to check whether there are data to read.

I guess by "we", you mean the caller. In which case, there is at least one (i.e. serial_getc()) that will not check the status before calling getc(). Instead, it will wait if the helper returns 0.

Looking at the other UART driver, none of them seem to busy loop. So, at least for consistency, we should avoid the busy loop here.

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.