summaryrefslogtreecommitdiffstats
path: root/c/src/libchip/network/sonic.c
diff options
context:
space:
mode:
authorMartin Galvan <martin.galvan@tallertechnologies.com>2016-05-06 17:08:47 -0300
committerMartin Galvan <martin.galvan@tallertechnologies.com>2016-05-06 17:08:47 -0300
commitb4d7d5d52e6459ed4fe490ca272fb6cb83e512aa (patch)
tree32ea722fa8c7981a9156dad56b2de62d05d4b89b /c/src/libchip/network/sonic.c
parentscore: Avoid Giant lock for CBS scheduler (diff)
downloadrtems-b4d7d5d52e6459ed4fe490ca272fb6cb83e512aa.tar.bz2
sonic.c: Fix warning on gcc 6
GCC 6.0 previews give the following warning on sonic.c: ../../../../../rtems/c/src/libchip/network/sonic.c:837:11: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation] This was discussed here: https://lists.rtems.org/pipermail/devel/2016-March/014004.html and we concluded it would be better to rewrite the entire snippet.
Diffstat (limited to '')
-rw-r--r--c/src/libchip/network/sonic.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/c/src/libchip/network/sonic.c b/c/src/libchip/network/sonic.c
index 1cd6cba1a2..d81c25130c 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) );
}
/*