]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
serial: bcm283x_mu: make pending values more explicit
authorStephen Warren <swarren@wwwdotorg.org>
Thu, 14 Apr 2016 04:29:52 +0000 (22:29 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 18 Apr 2016 21:11:47 +0000 (17:11 -0400)
dm_serial_ops.pending should return the number of characters, not just a
valid C Boolean integer value. The existing code does already does this,
but only as an accident since BCM283X_MU_LSR_RX_READY happens to be
BIT(0). Enhance the code to be more explicit about the values it returns.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
drivers/serial/serial_bcm283x_mu.c

index fc36bc0e85d67d808b166521d67149c5a802a7d9..7357bbfb26798ade1fb228140bcfd7f6e25bf052 100644 (file)
@@ -116,9 +116,9 @@ static int bcm283x_mu_serial_pending(struct udevice *dev, bool input)
 
        if (input) {
                WATCHDOG_RESET();
-               return lsr & BCM283X_MU_LSR_RX_READY;
+               return (lsr & BCM283X_MU_LSR_RX_READY) ? 1 : 0;
        } else {
-               return !(lsr & BCM283X_MU_LSR_TX_IDLE);
+               return (lsr & BCM283X_MU_LSR_TX_IDLE) ? 0 : 1;
        }
 }