xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] xen/arm: drivers: scif: Remove dead code
@ 2016-06-21  9:15 Dirk Behme
  2016-06-21  9:15 ` [PATCH 2/3] xen/arm: drivers: scif: Remove unused variables Dirk Behme
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Dirk Behme @ 2016-06-21  9:15 UTC (permalink / raw)
  To: xen-devel, Julien Grall, Stefano Stabellini
  Cc: Oleksandr Tyshchenko, Iurii Konovalenko, Dirk Behme

In scif_uart_init() uart->baud is set to BAUD_AUTO. So its a basic error
if this is different later. Detect this by an ASSERT, but remove the
dead code normally never reached.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
---
 xen/drivers/char/scif-uart.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c
index 51a2233..ca88c0f 100644
--- a/xen/drivers/char/scif-uart.c
+++ b/xen/drivers/char/scif-uart.c
@@ -143,23 +143,12 @@ static void __init scif_uart_init_preirq(struct serial_port *port)
     scif_writew(uart, SCIF_SCSMR, val);
 
     ASSERT( uart->clock_hz > 0 );
-    if ( uart->baud != BAUD_AUTO )
-    {
-        /* Setup desired Baud rate */
-        divisor = uart->clock_hz / (uart->baud << 4);
-        ASSERT( divisor >= 1 && divisor <= (uint16_t)UINT_MAX );
-        scif_writew(uart, SCIF_DL, (uint16_t)divisor);
-        /* Selects the frequency divided clock (SC_CLK external input) */
-        scif_writew(uart, SCIF_CKS, 0);
-        udelay(1000000 / uart->baud + 1);
-    }
-    else
-    {
-        /* Read current Baud rate */
-        divisor = scif_readw(uart, SCIF_DL);
-        ASSERT( divisor >= 1 && divisor <= (uint16_t)UINT_MAX );
-        uart->baud = uart->clock_hz / (divisor << 4);
-    }
+    ASSERT( uart->baud == BAUD_AUTO );
+
+    /* Read current Baud rate */
+    divisor = scif_readw(uart, SCIF_DL);
+    ASSERT( divisor >= 1 && divisor <= (uint16_t)UINT_MAX );
+    uart->baud = uart->clock_hz / (divisor << 4);
 
     /* Setup trigger level for TX/RX FIFOs */
     scif_writew(uart, SCIF_SCFCR, SCFCR_RTRG11 | SCFCR_TTRG11);
-- 
2.8.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-06-21 13:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21  9:15 [PATCH 1/3] xen/arm: drivers: scif: Remove dead code Dirk Behme
2016-06-21  9:15 ` [PATCH 2/3] xen/arm: drivers: scif: Remove unused variables Dirk Behme
2016-06-21 12:17   ` Julien Grall
2016-06-21  9:15 ` [PATCH 3/3] xen/arm: drivers: scif: Add clock auto detection Dirk Behme
2016-06-21 12:20   ` Julien Grall
2016-06-21 12:30     ` Dirk Behme
2016-06-21 12:33       ` Julien Grall
2016-06-21 10:16 ` [PATCH 1/3] xen/arm: drivers: scif: Remove dead code Oleksandr Tyshchenko
2016-06-21 12:15   ` Julien Grall
2016-06-21 12:54     ` Oleksandr Tyshchenko
2016-06-21 13:01       ` Dirk Behme
2016-06-21 13:22         ` Oleksandr Tyshchenko
2016-06-21 13:07       ` Julien Grall
2016-06-21 13:11         ` Oleksandr Tyshchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).