From patchwork Fri Feb 15 04:51:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 220624 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9F21E2C02BB for ; Fri, 15 Feb 2013 15:52:34 +1100 (EST) Received: from localhost ([::1]:56988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6DHk-0005RL-Oz for incoming@patchwork.ozlabs.org; Thu, 14 Feb 2013 23:52:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6DHY-0005If-AS for qemu-devel@nongnu.org; Thu, 14 Feb 2013 23:52:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6DHU-0004W8-AS for qemu-devel@nongnu.org; Thu, 14 Feb 2013 23:52:20 -0500 Received: from mail-da0-f41.google.com ([209.85.210.41]:52584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6DHU-0004Vu-4m for qemu-devel@nongnu.org; Thu, 14 Feb 2013 23:52:16 -0500 Received: by mail-da0-f41.google.com with SMTP id e20so1340706dak.0 for ; Thu, 14 Feb 2013 20:52:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state; bh=WakxM562srMd8HOH/yuYwup+IM1HZ0KsJdvM0BuPKLw=; b=OpIW9x7ngO9eJ0xPdTMrtTznAMjz5Oii44o3dq3beEkTMR+xLkp712MFPRL2Aksl6+ qIQ9HOOgLklkfgftkphbSskDXMBxsdjB/oFy/UiarPpqDeCvuGw4c/mM6ceU2NP5DFvr koK+kKE8c+MSw3THK7tI3lbbBrgw5i3WytNBVL4QZ5ixVG+T2ewFkJipZc8wK50ioWXI rOb08YQ/y001lvzyD4x/RQ2nGwuSJcH30mRr8fkRWk35Kczdhxxi7nehtjiAvnlVEWlP DBiMEdID1IafdYuyQBhyM56l6RgVyKxpY+pwon/kSETpqku6Jd5g3uUoTyyYzUh7ECip AsYA== X-Received: by 10.66.82.35 with SMTP id f3mr9897445pay.49.1360903935243; Thu, 14 Feb 2013 20:52:15 -0800 (PST) Received: from localhost ([101.169.162.247]) by mx.google.com with ESMTPS id c8sm3467595pbq.10.2013.02.14.20.52.11 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 14 Feb 2013 20:52:14 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2013 14:51:37 +1000 Message-Id: X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQnAptrZMCGrHMXBsByibJbt3ThNPwoerGrfXTadQU4kdUnrd4QmQcCw1AxebVDVaZUeIf4o X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.41 Cc: edgar.iglesias@gmail.com, Peter Crosthwaite , peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH v1 2/5] cadence_gem: factor out can_rx() logic replication X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/cadence_gem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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; }