Advice Wanted on sonic.c Indentation Warning

Martin Galvan martin.galvan at tallertechnologies.com
Tue Mar 29 14:25:39 UTC 2016


Hi again, I'm attaching the patch for review. It compiles fine for erc32,
though I couldn't test the samples (I don't have any sparc boards, and QEMU only
has leon3 and sun-4m).

I wrote to Amar about my write access but I didn't hear back from him.
Is there a way to check if my account exists using ssh? E.g. for sourceware
we have 'ssh sourceware.org alive'.

---
 c/src/libchip/network/sonic.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/c/src/libchip/network/sonic.c b/c/src/libchip/network/sonic.c
index 1cd6cba..6e69b9e 100644
--- a/c/src/libchip/network/sonic.c
+++ b/c/src/libchip/network/sonic.c
@@ -826,19 +826,17 @@ SONIC_STATIC void sonic_rda_wait(
        * driver has to move the RRP back *two* entries to
        * reuse the receive buffer holding the giant packet.
        */
-      for (i = 0 ; i < 2 ; i++) {
-        if ((*sc->read_register)( rp, SONIC_REG_RRP ) ==
-            (*sc->read_register)( rp, SONIC_REG_RSA ))
-          (*sc->write_register)(
-            rp,
-            SONIC_REG_RRP,
-            (*sc->read_register)( rp, SONIC_REG_REA )
-          );
-          (*sc->write_register)(
-             rp,
-             SONIC_REG_RRP,
-             (*sc->read_register)(rp, SONIC_REG_RRP) - sizeof(ReceiveResource_t)
-          );
+      for (i = 0; i < 2; ++i) {
+          uint32_t rrp = (*sc->read_register)( rp, SONIC_REG_RRP );
+          const uint32_t rsa = (*sc->read_register)( rp, SONIC_REG_RSA );
+
+          if (rrp == rsa) {
+              const uint32_t rea = (*sc->read_register)( rp, SONIC_REG_REA );
+              (*sc->write_register)( rp, SONIC_REG_RRP, rea );
+          }
+
+          rrp = (*sc->read_register)(rp, SONIC_REG_RRP);
+          (*sc->write_register)( rp, SONIC_REG_RRP, rrp - sizeof(ReceiveResource_t) );
       }
 
       /*
-- 
2.8.0



More information about the devel mailing list