From patchwork Thu Dec 14 14:52:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10112375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 052026019C for ; Thu, 14 Dec 2017 14:55:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA74122A68 for ; Thu, 14 Dec 2017 14:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEEC6237F1; Thu, 14 Dec 2017 14:55:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 54E3D22A68 for ; Thu, 14 Dec 2017 14:55:00 +0000 (UTC) Received: from localhost ([::1]:41367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePUuZ-0002eB-5u for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 Dec 2017 09:54:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePUt3-0001MK-TG for qemu-devel@nongnu.org; Thu, 14 Dec 2017 09:53:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePUt3-0000K9-2r for qemu-devel@nongnu.org; Thu, 14 Dec 2017 09:53:25 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:40468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePUt0-0000DW-8F; Thu, 14 Dec 2017 09:53:22 -0500 Received: by mail-pg0-x243.google.com with SMTP id k15so3549869pgr.7; Thu, 14 Dec 2017 06:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gHgUtmN0/rGU/APCPhW0EAHnmsZlsiEW/PZANp51ENA=; b=T0ndEdMNnV7WaRrU+I0GsAMkNpO9GD+jXEKKs5kspeuNe3FpW6FHulidUR7u7/YC+k rcuCcmxy3I56ZeTfYXuOOFmVaDOZ1o3up+INcfZS59MfrYP+N5oVjJ2wdckbrCJrYW+r qmTrA6rMFMEtWON+lfT4phdIlHxsC9QZ5kx6Sr7Z7e5+B1rrdc8vHTGcdtWdE62tJ4Jz mXXe4Xrd0rRHXte8PX6ABHy17mFzD/iexvA6rCN1I/Umf2w88NSYb4UrQXdQRI2+xxfO S+U9Z9tMsHERCwR7dEz+yeYkE9nJh02aiq7lpXqBZw5hD4EKP50tR40oDahPafoAYhkM CUWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gHgUtmN0/rGU/APCPhW0EAHnmsZlsiEW/PZANp51ENA=; b=bgACIEs/eZbmBahdgm2Kwo1A9n0e32A5+wRabpeVutqmbiJQUxnlsVVb/RiirWZAqg LLBezPUToe9PI/Nh+gKKkeDobfzMRLkPTYBwbiVqpzIyEqDLJ42K3cbsTyrVxgFUOALe npN4xi6SSLUCjcRxrqCxZM4J3eeVY/o3/IA0ekg5XwBYPvr8OoRE5pS6j2OWtzV++FtB 4+h2Kt7okJ7/B/1qoiI4d0LKXvZWlamEU9HB7S7HeuDm0gNf4sFn/D3wBWQqUiiA6rSm FfDGjxFdJTHLB/4GPnrdhaUp53YYYvxiT50Hl1OJyhpXTDKsyg3ofAJqop0jT7MnzNq8 9Dqg== X-Gm-Message-State: AKGB3mK9aHBdRIFET9ywd6wrhaEPvtLU0Y41u8HyUIqQ8TXTiVOYktoF 6X8NEN5NDcwOlX8luLTMAW98p5FN X-Google-Smtp-Source: ACJfBosgfxRs/hVoOWiyeKblcV6AkOJWIgxwodenDyQKeeJDAgGw6kWP7DKpC2WGt7memO+rLb8y+g== X-Received: by 10.98.197.68 with SMTP id j65mr10039598pfg.176.1513263200919; Thu, 14 Dec 2017 06:53:20 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id e7sm8757439pfj.44.2017.12.14.06.53.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 06:53:19 -0800 (PST) From: Andrey Smirnov To: qemu-arm@nongnu.org Date: Thu, 14 Dec 2017 06:52:42 -0800 Message-Id: <20171214145255.31545-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171214145255.31545-1-andrew.smirnov@gmail.com> References: <20171214145255.31545-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v2 02/15] imx_fec: Refactor imx_eth_enable_rx() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrey Smirnov , Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, yurovsky@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Refactor imx_eth_enable_rx() to have more meaningfull variable name than 'tmp' and to reduce number of logical negations done. Cc: Peter Maydell Cc: Jason Wang Cc: Philippe Mathieu-Daudé Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Cc: yurovsky@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Andrey Smirnov Reviewed-by: Philippe Mathieu-Daudé --- hw/net/imx_fec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 88b4b049d7..8b2e4b8ffe 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -536,19 +536,19 @@ static void imx_eth_do_tx(IMXFECState *s) static void imx_eth_enable_rx(IMXFECState *s) { IMXFECBufDesc bd; - bool tmp; + bool rx_ring_full; imx_fec_read_bd(&bd, s->rx_descriptor); - tmp = ((bd.flags & ENET_BD_E) != 0); + rx_ring_full = !(bd.flags & ENET_BD_E); - if (!tmp) { + if (rx_ring_full) { FEC_PRINTF("RX buffer full\n"); } else if (!s->regs[ENET_RDAR]) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } - s->regs[ENET_RDAR] = tmp ? ENET_RDAR_RDAR : 0; + s->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR; } static void imx_eth_reset(DeviceState *d)