Patchwork [14/17] cadence_gem: factor out can_rx() logic replication

login
register
mail settings
Submitter Peter Maydell
Date Feb. 28, 2013, 6:54 p.m.
Message ID <1362077643-31443-15-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/224151/
State New
Headers show

Comments

Peter Maydell - Feb. 28, 2013, 6:54 p.m.
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

The gem_receive() function replicates the logic for whether or not the device
can rx. Just call the actual gem_can_receive() function in place.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: bf7f93969f3e01fbc76d68d2955307fdbad11bb1.1360901435.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/cadence_gem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/hw/cadence_gem.c b/hw/cadence_gem.c
index e6032ea..966ab4f 100644
--- a/hw/cadence_gem.c
+++ b/hw/cadence_gem.c
@@ -615,7 +615,7 @@  static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
     s = qemu_get_nic_opaque(nc);
 
     /* Do nothing if receive is not enabled. */
-    if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_RXENA)) {
+    if (!gem_can_receive(nc)) {
         return -1;
     }