From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431109; cv=none; d=zohomail.com; s=zohoarc; b=LY79JsoLVCAOefxskgthM1W3aKB7QOYiyxkq/2qrndU4NKkAVQRTq9qyW0d5xpeUkZvWFOCmchtRqdCgAcnqjo6h9HUAqXeU2qVxPe1nC0dwd7qq80xJk6ZMNAWpWk7WBG41pPZikvifzKn0CUQXJV7NvV4ZHzawVnLFYbzdiB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431109; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CS6YPb3Ihef4vMzBH/zBkjylrRdhrNd8BsGM+mGSMes=; b=GgKTo4+kCfNWevdQb7loEORPQyY6wnIUSwX/BrthE5bPZZxRSvlRqlHMnFsUzr2fam4dQ+mhmBsGeT8DB7VWd4uN+CNfeylQsA1BNRH79uEwNgkiCEAvKDn273TAVKoqTHRWIwI0Gpr1T7O3lWARB/u6rQlu+Sl4aKQe2+b53Yg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431109920360.0521958948376; Thu, 5 Mar 2020 09:58:29 -0800 (PST) Received: from localhost ([::1]:54368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ulQ-0000if-IP for importer@patchew.org; Thu, 05 Mar 2020 12:58:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47032) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9uk4-00079x-NK for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9uk3-0002hI-Is for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:04 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51440 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9uk3-0002gs-Ft for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:03 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-LpT-CZ8dNiCx6aLBtvX6gA-1; Thu, 05 Mar 2020 12:56:59 -0500 Received: by mail-wm1-f69.google.com with SMTP id t2so1876387wmj.2 for ; Thu, 05 Mar 2020 09:56:59 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id f3sm15240718wrs.26.2020.03.05.09.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:56:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CS6YPb3Ihef4vMzBH/zBkjylrRdhrNd8BsGM+mGSMes=; b=ivv4vi0vf4qc93h8r5KEyIZAYl/Hwf5siqawO9MkegtvvzMAvBBAnnIpdKk1jrZGqrALY6 uFFpgoHrcWYl8+srvuL8Ojyv5lXBeEMCnzFXRPJSfI5L52sOCINxpfhP2HLoLMPAosc3GL wZx3+1erwt9pDHmGvrLYzcLJvOlGFzk= X-MC-Unique: LpT-CZ8dNiCx6aLBtvX6gA-1 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=6JrFb878lHzGwYsPjMk4F0hM2hVACJ2Pnf75ZdCaRHg=; b=aGe5zXssWmspgjWRWemrPBIqnQXFgmnVn8oiY+UkkREAkjEZvxRUs5cVFh5ATN/Nap clXfbERcFK/sSyU/OmwRfKLB5RmACofa0jRflTVzzhrBjJz6RLcb4aCiY6bMXDaPBMpD dRb/E+KJrMTw/AtS7EY3TEnHlbOOfdMFdPesET6C1Vh12ajEvC37uErXb0g5SQ4DoWNk 5zXv4+LQDcR7zse6wCbMngBXv1E3PGakKu1GGH2lNDKfI/C9oKGKXVJktsh1IcKWEHXM 5T0st/pP5fc51MX+/2EXd00kT9IbT1/E+qFGUzD+vTx4ELdjljLjyTbOnb+QKVmBjW5b tzyA== X-Gm-Message-State: ANhLgQ1toor/zS7nEPjUKuDlGq8dWi9AcJtccxYU0pH5jEDCtJeoEyTd dSRBdPEdse2HyWtQm7jgFpC3USqD3YcQQH5oJuJ1oaufjuRTTd4LwZxdeVOZvgJTH350tHF+a3w lRB4p5+wHI+a5GTc= X-Received: by 2002:a5d:4885:: with SMTP id g5mr97807wrq.93.1583431018457; Thu, 05 Mar 2020 09:56:58 -0800 (PST) X-Google-Smtp-Source: ADFU+vskaAkFKgbEQH+pNIGFb8Sr3L1S1HvDcf8VKDBvX02lrY1dc2utRLDl7z40uKKyLXE/PBLOtw== X-Received: by 2002:a5d:4885:: with SMTP id g5mr97785wrq.93.1583431018221; Thu, 05 Mar 2020 09:56:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/6] hw/net/e1000e_core: Let e1000e_can_receive() return a boolean Date: Thu, 5 Mar 2020 18:56:45 +0100 Message-Id: <20200305175651.4563-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The e1000e_can_receive() function simply returns a boolean value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Paolo Bonzini --- hw/net/e1000e_core.h | 2 +- hw/net/e1000e_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h index 49abb136dd..aee32f7e48 100644 --- a/hw/net/e1000e_core.h +++ b/hw/net/e1000e_core.h @@ -143,7 +143,7 @@ e1000e_core_set_link_status(E1000ECore *core); void e1000e_core_pci_uninit(E1000ECore *core); =20 -int +bool e1000e_can_receive(E1000ECore *core); =20 ssize_t diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 94ea34dca5..e0bafe975b 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -967,7 +967,7 @@ e1000e_start_recv(E1000ECore *core) } } =20 -int +bool e1000e_can_receive(E1000ECore *core) { int i; --=20 2.21.1 From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431129; cv=none; d=zohomail.com; s=zohoarc; b=H4dI9y/g6c1Go/jyPuzbXwDJMbGKx0DjUUiN5qRP4EMGxVLdNxgzwYHLW7yp1SXQyfssJ2+scTKUS6Cqvwb2QNFTjOAX5yRIpgDtPPEuIpW7i0PNq4gnfZ0vajTKJ0g0E2+LZ5l71TYnUlZCtvwNzXzprHW0O78RXdzMVuPjAUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431129; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tw4AXOFUsVnWWH/+MEC8+/Jzhzp7Eu5EQAdmUFQrX44=; b=P+zfukajmJnG4nK/rxppNDhgfPSaNhpWU3MpvCBQomX3OzSTEfK+NTI0ZEMov6IjKOF9L5Z1yUxh+dadNeQP4lUfAJMKrKvAanYpku0YNaCeP7h4STbC2qsoGS1E8bEFk4JE90cANukL6URz7uGc/YeHP5gvftA7FKkGhOjx50I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431129355428.37637578146393; Thu, 5 Mar 2020 09:58:49 -0800 (PST) Received: from localhost ([::1]:54370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ulk-000160-1Y for importer@patchew.org; Thu, 05 Mar 2020 12:58:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47067) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9uk7-0007Gf-UG for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9uk6-0002kL-Un for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:07 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:26938 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9uk6-0002jQ-QD for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:06 -0500 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-jk2EZzg5NaaLkL2LTD_Xgw-1; Thu, 05 Mar 2020 12:57:05 -0500 Received: by mail-wr1-f70.google.com with SMTP id q18so2601808wrw.5 for ; Thu, 05 Mar 2020 09:57:04 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id d203sm9699558wmd.37.2020.03.05.09.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tw4AXOFUsVnWWH/+MEC8+/Jzhzp7Eu5EQAdmUFQrX44=; b=QrUl+qX7YjvvjTEi0ddyZwljl9VY6VpIEHCeM4702cd9LzZw9uCHaKO1IIPy7RR/ZWFLfh gLpFoONjMFjZe1ureK37acscKKSFjD8JIEGYepbIAo0Rit0skoXxDCXSo0iwi/ZUAmy71H mzpUACiBlj9QMnZqnvJLpM4pL64atQc= X-MC-Unique: jk2EZzg5NaaLkL2LTD_Xgw-1 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=+MbtoWKkcqHCz+vfqyTzTQ/PF32JMBmzxf8ccd5VY20=; b=uFsv2zuh2IZZqnzW/AyOGxmJ+zeHyi6pi0goP3LTBsrVwjpGkemm3rZSYt/QFh0NDa SSnzWGA3bMcD5hv5J6wZEnAEnTYrBpkrJ0khN8YqQZe4tZrbcZvE5Inqzyvle04y+BV6 eMabmsV4JM6Q2ECsskJTOvNRxcM36qpw8jnZOmYdtZT61DsGNewv6BzPnyG5NDj3Mxyd le3Co4kDQPP4Kan5nAUKv/W8p1ZNXNIaR1A0DmB6E8NLYNeok9RT6IfVfA55zOgpFFJL WXNYSpVfyYFLC/tGxwjJ/ofWkTxeslmKnnFIhd77VjIV0o0RMx0szI8lTFNyWRxgADlN paOg== X-Gm-Message-State: ANhLgQ1/LNmeNDA0TZCZgE32OwyN41ktfsSKjNbBk2CySdTxeIjwnjoh EZU2GdbgMrTM9Y65RFPLQOrX6lnyaZT8toJU3ON+DmSvFGFNJkf/tJe84lBn+6u/3snQjq/OnYt NXge9wufFWhpm0do= X-Received: by 2002:a05:6000:108:: with SMTP id o8mr120891wrx.312.1583431023632; Thu, 05 Mar 2020 09:57:03 -0800 (PST) X-Google-Smtp-Source: ADFU+vuWmokTTXWO/3o9W34TZ6DMM4KH3ciqzOZWMvRg7PGY3DDIVccA2xbcBAAbGbz94dLSvuoqxg== X-Received: by 2002:a05:6000:108:: with SMTP id o8mr120874wrx.312.1583431023428; Thu, 05 Mar 2020 09:57:03 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean Date: Thu, 5 Mar 2020 18:56:46 +0100 Message-Id: <20200305175651.4563-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The smc91c111_can_receive() function simply returns a boolean value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater --- hw/net/smc91c111.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index e9eb6f6c05..02be60c955 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -130,16 +130,16 @@ static void smc91c111_update(smc91c111_state *s) qemu_set_irq(s->irq, level); } =20 -static int smc91c111_can_receive(smc91c111_state *s) +static bool smc91c111_can_receive(smc91c111_state *s) { if ((s->rcr & RCR_RXEN) =3D=3D 0 || (s->rcr & RCR_SOFT_RST)) { - return 1; + return true; } if (s->allocated =3D=3D (1 << NUM_PACKETS) - 1 || s->rx_fifo_len =3D=3D NUM_PACKETS) { - return 0; + return false; } - return 1; + return true; } =20 static inline void smc91c111_flush_queued_packets(smc91c111_state *s) --=20 2.21.1 From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431261; cv=none; d=zohomail.com; s=zohoarc; b=Og520JubwYot/S1oMJxB10LdYtOTvWloPkFuzXHWmRnXkmV/U1cpDaZk//oQjoKmtA5GLfPE0pv6hkYd5PpkaMMTVJ+rDqZ+mKY0yor4jRdcGCAafZWBiP76F9KNbr8pt3qIOWImcWVlcqTltNdJIdkr3+VedJdNu0CLHhkUouw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NGHswVvKeRQxvy0qEQcO1JqCKgI3zH8psI7B4R/7eKQ=; b=jsZkSZQKgdocYuDDaGPR4YS7ldixX50FqC11hElInqF8QT6NbkIX/C7l5o2UFfSMi0TbggqA/IdrTScLimB96E9oTmUYKkuQtWnOtyPmCfZc5lqSHmFudjb3zU/oM742s7iuGp6Mscqx6B39fI1X38vD7/Z5GG7Cb+z1JAk1feg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431261773722.0331412764081; Thu, 5 Mar 2020 10:01:01 -0800 (PST) Received: from localhost ([::1]:54420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9uns-0004eH-Pg for importer@patchew.org; Thu, 05 Mar 2020 13:01:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47124) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ukD-0007PX-0c for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9ukC-0002py-30 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:12 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44942 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9ukB-0002pW-Vv for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:12 -0500 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-FghEmYpzOSWxDiVDGS7gBQ-1; Thu, 05 Mar 2020 12:57:10 -0500 Received: by mail-wm1-f72.google.com with SMTP id v21so1868937wml.5 for ; Thu, 05 Mar 2020 09:57:09 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id r28sm47991406wra.16.2020.03.05.09.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGHswVvKeRQxvy0qEQcO1JqCKgI3zH8psI7B4R/7eKQ=; b=M5cN9iEOPFcW+N/CiAJk18qybamIA8aJ7osIq7gxBMRpZzshSWf2fUw3YpRgOWv/SerOe5 Ai6ppMrI8ZwJGprtotP/KLRnd9mhPhkDIrtGUXC/2oq/khUsGl7lPtmEhkHYEM5/5r4vM0 Wy/nixJZNoV4jreDipHzTxkjQvapwcs= X-MC-Unique: FghEmYpzOSWxDiVDGS7gBQ-1 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=60PR0G6qPI4q8UeizT2SJgOmqcakhr9AMbPfUXTnwEg=; b=XAEJzTgqhOgh/QczHjAx3TDLGs2kOZZZv0Gk6I6Kafi0ZkG8kGY738BN2uI4PyxCRR 59nVfjCgcFAy8jQksv4pjPGrnKUqolElYEUtNXrXMYLXy7aRKDH+CTH5B/vX24B2KZsg YUYmCqzYnJYPy4JL0Mdk/J4ew9BZTcLQUwQxW16oPQsQc6Y9C15JhoP+K4ONvAJ2NJNV PUcLHbGihXBVIlj73/7LP1s/DQKZUCGgSqc65AgpBag/pYol9uHZVBnGLoSbCx1RlCwv XbJwb9ek8AYGgWWcnzYde1RwUjMhHUArnkca5IiDiE9iWvqWSEiOX+FXULaRUco441rZ GcLQ== X-Gm-Message-State: ANhLgQ0V/2c/XET85GF0V1ZvXQjC0NKBcApIiXCco7079+URlV1bB5Nk SqI/70CGI3+nWwsSgVnrs6t5HbdQuF+A7YrVBZEDBhgio69/9C3NocDmNMBIA4bNtPgRrXN/goX oosiVTgsevsXlo/k= X-Received: by 2002:a5d:4d48:: with SMTP id a8mr104578wru.35.1583431028616; Thu, 05 Mar 2020 09:57:08 -0800 (PST) X-Google-Smtp-Source: ADFU+vsN5NJ5s0QVpQKKfqwHa709/Td64F5/lWY+JWepk7pducB47SHKJ3+0JaCzv29sFkel3LOe+g== X-Received: by 2002:a5d:4d48:: with SMTP id a8mr104543wru.35.1583431028408; Thu, 05 Mar 2020 09:57:08 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/6] hw/net/rtl8139: Simplify if/else statement Date: Thu, 5 Mar 2020 18:56:47 +0100 Message-Id: <20200305175651.4563-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Rewrite: if (E) { return A; } else { return B; } /* EOF */ } as: if (E) { return A; } return B; } Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater --- hw/net/rtl8139.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index ae4739bc09..ef3211537f 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -808,11 +808,11 @@ static int rtl8139_can_receive(NetClientState *nc) /* ??? Flow control not implemented in c+ mode. This is a hack to work around slirp deficiencies anyway. */ return 1; - } else { - avail =3D MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, - s->RxBufferSize); - return (avail =3D=3D 0 || avail >=3D 1514 || (s->IntrMask & RxOver= flow)); } + + avail =3D MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, + s->RxBufferSize); + return avail =3D=3D 0 || avail >=3D 1514 || (s->IntrMask & RxOverflow); } =20 static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, = size_t size_, int do_interrupt) --=20 2.21.1 From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431228; cv=none; d=zohomail.com; s=zohoarc; b=i+gdkWwBKEF6Q6G8pR5NOH9ZcHXSPge/RPQBlji2wIiYXfTHNnry+LHH5Img9IWE7Nh+w36T20MO5icxY6fciWaRKgVR0x2zQUG8e4/9spyC6aBhVNs5mE0nH5dG3lyZ/NKDBbyfvRYXHFHeTXIPco1Wor2EaJj4Wi8gW8EcU9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hFzOf21mMRMWBpr53hzhWDWl6EUS9wSXvSla5EkKK0o=; b=RrivAEgwNaLyHFu8Y0iZGkhX6Fk4a6SXv/dmiooxTrSxS1EZo3yoEskXwucWwDCsOKTl8p6igLXESI0bk0AfM8C604MMnyUZI1LavdqRhRb4WJ1fOoSgvSOC2q9crtQtRsiMQZM4J27LcL3SJn/k7wYKcPSeZAdNZrgZQfqgKBY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431228399853.2650985811191; Thu, 5 Mar 2020 10:00:28 -0800 (PST) Received: from localhost ([::1]:54400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9unL-0004DC-8B for importer@patchew.org; Thu, 05 Mar 2020 13:00:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47163) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ukI-0007e8-Ce for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9ukH-0002us-Be for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31417 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9ukH-0002u3-8Y for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:17 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-ax-9TwH9NSi2jxB13UuU3w-1; Thu, 05 Mar 2020 12:57:15 -0500 Received: by mail-wm1-f71.google.com with SMTP id r19so2383294wmh.1 for ; Thu, 05 Mar 2020 09:57:15 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id a1sm5164615wru.75.2020.03.05.09.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hFzOf21mMRMWBpr53hzhWDWl6EUS9wSXvSla5EkKK0o=; b=EfFQqDHTUEg4jFEla9iviswXvoCTW1AM9UBrFdvs3LOGgstRyzKr+WEV4dNjsAfezDkWgG SquDItZc8wqGiMaQF4QENJrjqjervRk9lnMvYMtBl8QsGFuVy8OPAPSclM+cg7KekzYzsY JJ5KXIBOPD3qUEdJX84EEmWf/Y7r0A4= X-MC-Unique: ax-9TwH9NSi2jxB13UuU3w-1 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=KuZu0l8YBqYXQOonzFZy05S+UvA1gUT1JdqmPkqMlAs=; b=tVG4lZNPAk4VEbYA/tO6uvw9p4Ta7Ojoz5jcngsBf75jaLqSHjpGZOsbamr8zqRXyG AVkEXLjdkyahSAUs7F+Hfk/4Junyji7oBEEpFtcPoe2ekvgy6eFMQ8Quq5VEY0uXm7Bg oSzGs+4xzwzKGoc8fikcPks6MBMK0QbLGznmcv44WfU2GUBNhT2fmJcKlmjdZU4C+k5B 5hj+FiKeK+hkFP8EQE92BOSVEnpBBHZ83zzNs9yp8lv7zNo8gOg8qdq/xjo9ruq74Ggb 0i8kuAXcDn+9r0NmY9OsfK0ChF4ZvFmXEdXHDGwZ3i2qKsmC8AfXVrWnGrobPWp/EKQf ipYA== X-Gm-Message-State: ANhLgQ2IhiT63Cj4ZDe/SogK+ryvvm6p52zlEke8+LUsPwRozDUuBznh BUzxKCQApgZDhRnmBkV3IFppRlzfr/LKl4E4cotMYnDk0zyTLqB7fK01bO0X6SQcqVsn1B/7RXF mzx+yNmvwuwljMYY= X-Received: by 2002:a1c:750e:: with SMTP id o14mr10482418wmc.156.1583431033782; Thu, 05 Mar 2020 09:57:13 -0800 (PST) X-Google-Smtp-Source: ADFU+vt9kbFZJCsgnlMYHXpGvqWjyZ0ERbNoxVPqdKTWvq9o2jftfKQM7F/6kgRnJ1dixgvdd0OPnw== X-Received: by 2002:a1c:750e:: with SMTP id o14mr10482398wmc.156.1583431033617; Thu, 05 Mar 2020 09:57:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/6] hw/net/rtl8139: Update coding style to make checkpatch.pl happy Date: Thu, 5 Mar 2020 18:56:48 +0100 Message-Id: <20200305175651.4563-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" We will modify this code in the next commit. Clean it up first to avoid checkpatch.pl errors. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater --- hw/net/rtl8139.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index ef3211537f..be9a0af629 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -799,10 +799,12 @@ static int rtl8139_can_receive(NetClientState *nc) int avail; =20 /* Receive (drop) packets if card is disabled. */ - if (!s->clock_enabled) - return 1; - if (!rtl8139_receiver_enabled(s)) - return 1; + if (!s->clock_enabled) { + return 1; + } + if (!rtl8139_receiver_enabled(s)) { + return 1; + } =20 if (rtl8139_cp_receiver_enabled(s) && rtl8139_cp_rx_valid(s)) { /* ??? Flow control not implemented in c+ mode. --=20 2.21.1 From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431147; cv=none; d=zohomail.com; s=zohoarc; b=DIndTINkEAtEg05JGX9RVrh7h1D77KPDZJijWVOyjWI1iw0iElkNgzk+XTb4U4CfWV9s2TJPTGUuH4YveN9+V+lFZWy1KljoW6RPTwrLdzpMYrXABigh95upa9H1JU5ZNJ3r1Vv+53soZTDCRlut61EoIGFTjDuI9uwWGeM1ZRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431147; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q/L4h+I3OUjcRiZvyCto15kYsTgQ6JrKBLZ6AJj9sdo=; b=dWfW65ThpinpQnqfzxE6C0fmZHUfpULqrb+dEy5g7pcLDTbqAIhEL2gOX/h+Os8LA18ZoZIMrpmFd4v1FM8zsOpdsdH58ubidwgITqa0trRINQBoo582T38GCLhG98vqhDhFd/ROf1DH4ke0QVpNUp3s7obtIJgsyPFwecJXvqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431147842155.92153247149554; Thu, 5 Mar 2020 09:59:07 -0800 (PST) Received: from localhost ([::1]:54372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9um2-0001vG-Lj for importer@patchew.org; Thu, 05 Mar 2020 12:59:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47210) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ukQ-0007zW-0D for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9ukN-00034H-IG for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:25 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:34469 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9ukN-00033O-E9 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:23 -0500 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-eziA4-avNWmch6BR-jx5rQ-1; Thu, 05 Mar 2020 12:57:21 -0500 Received: by mail-wr1-f71.google.com with SMTP id b12so2626605wro.4 for ; Thu, 05 Mar 2020 09:57:21 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id y3sm10896099wmi.14.2020.03.05.09.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q/L4h+I3OUjcRiZvyCto15kYsTgQ6JrKBLZ6AJj9sdo=; b=cuU9s227Q3g57m5H021i3V9rqc7au2XdZVN4y4GWSwNhM+IgdaBirB1VCwnFRFjROoPrfs qkv7LislV5kJFviHLSz7+x5cXX5QMSSKjnpJHC1dEDYsK9E8HXTfq05ZgqTTMCaVpBzjLs vHAM/WAp7c+8oJmbTPoJ65Rbcb7SMk0= X-MC-Unique: eziA4-avNWmch6BR-jx5rQ-1 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=+CLVVpXHf357w7CX8JEgcz4sXRX31dg67N2A013l5dQ=; b=VJK7vHX4slJtFbNJJveAZ2nKcjX9//OAA0v96PwIG8FMbAXpHz21gu7hCy0rEdZNRu ECg6kDnLaPtas6M+Esb0+QK5tHZIQCSn4wN5H7V2uvVVSNPvSeDFFJrM3PtRdR4UeS1P 7bXczFaGaLwuSoAE0pLXA3oubT+iD9HSWa3CeAJFuT/wCsKhNt0MFJLHz6g99VME8MID dqw9DIQ6ee7Xi/n7L6neuy2lZE7O8Qpil5RkL13jxBf9q/BLiy7rkNRt8aqJR643VGU/ 60oktILdLbwy5Ykc2Dc1UXObA27/gKLuX2wUZbnFYalvIy4ZVMZHqvOYdinLRlL5HBZH Y3qQ== X-Gm-Message-State: ANhLgQ0Bb0h0bxRcsLv/I4mJV8O9riL13RawEv5uuz9/bd2monwa3YiJ J2+vTyjSh5Idqe18IVdN5hcbUjB+zOMCVUozotUZ9r+o5PLhxreVN2AOPaAef70JmH1A4iHkRLq 7qjHJqNVEjs/xWNY= X-Received: by 2002:adf:eece:: with SMTP id a14mr129655wrp.218.1583431039394; Thu, 05 Mar 2020 09:57:19 -0800 (PST) X-Google-Smtp-Source: ADFU+vvSgX9LCphGs2YhFpfKZ9PU4UPRimBiiGpMulwpCSjo/X6kWJ8rfauUjkiw5gKG284s+pl/5g== X-Received: by 2002:adf:eece:: with SMTP id a14mr129609wrp.218.1583431038885; Thu, 05 Mar 2020 09:57:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/6] hw/net: Make NetCanReceive() return a boolean Date: Thu, 5 Mar 2020 18:56:49 +0100 Message-Id: <20200305175651.4563-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The NetCanReceive handler return whether the device can or can not receive new packets. Make it obvious by returning a boolean type. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater --- hw/net/i82596.h | 2 +- include/net/net.h | 2 +- hw/net/allwinner_emac.c | 2 +- hw/net/cadence_gem.c | 8 ++++---- hw/net/dp8393x.c | 8 +++----- hw/net/e1000.c | 2 +- hw/net/e1000e.c | 2 +- hw/net/ftgmac100.c | 6 +++--- hw/net/i82596.c | 10 +++++----- hw/net/imx_fec.c | 2 +- hw/net/opencores_eth.c | 5 ++--- hw/net/rtl8139.c | 8 ++++---- hw/net/smc91c111.c | 2 +- hw/net/spapr_llan.c | 4 ++-- hw/net/sungem.c | 6 +++--- hw/net/sunhme.c | 4 ++-- hw/net/virtio-net.c | 10 +++++----- hw/net/xilinx_ethlite.c | 2 +- net/filter-buffer.c | 2 +- net/hub.c | 6 +++--- 20 files changed, 45 insertions(+), 48 deletions(-) diff --git a/hw/net/i82596.h b/hw/net/i82596.h index 1238ac11f8..f0bbe810eb 100644 --- a/hw/net/i82596.h +++ b/hw/net/i82596.h @@ -48,7 +48,7 @@ void i82596_ioport_writel(void *opaque, uint32_t addr, ui= nt32_t val); uint32_t i82596_ioport_readl(void *opaque, uint32_t addr); uint32_t i82596_bcr_readw(I82596State *s, uint32_t rap); ssize_t i82596_receive(NetClientState *nc, const uint8_t *buf, size_t size= _); -int i82596_can_receive(NetClientState *nc); +bool i82596_can_receive(NetClientState *nc); void i82596_set_link_status(NetClientState *nc); void i82596_common_init(DeviceState *dev, I82596State *s, NetClientInfo *i= nfo); extern const VMStateDescription vmstate_i82596; diff --git a/include/net/net.h b/include/net/net.h index e175ba9677..d191ee777e 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -42,7 +42,7 @@ typedef struct NICConf { /* Net clients */ =20 typedef void (NetPoll)(NetClientState *, bool enable); -typedef int (NetCanReceive)(NetClientState *); +typedef bool (NetCanReceive)(NetClientState *); typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t); typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, in= t); typedef void (NetCleanup) (NetClientState *); diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c index e9bbff8710..ddddf35c45 100644 --- a/hw/net/allwinner_emac.c +++ b/hw/net/allwinner_emac.c @@ -178,13 +178,13 @@ static uint32_t fifo8_pop_word(Fifo8 *fifo) return ret; } =20 -static int aw_emac_can_receive(NetClientState *nc) +static bool aw_emac_can_receive(NetClientState *nc) { AwEmacState *s =3D qemu_get_nic_opaque(nc); =20 /* * To avoid packet drops, allow reception only when there is space * for a full frame: 1522 + 8 (rx headers) + 2 (padding). */ return (s->ctl & EMAC_CTL_RX_EN) && (fifo8_num_free(&s->rx_fifo) >=3D = 1532); } diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 6340c1eaf8..51ec5a072d 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -505,44 +505,44 @@ static void phy_update_link(CadenceGEMState *s) } } =20 -static int gem_can_receive(NetClientState *nc) +static bool gem_can_receive(NetClientState *nc) { CadenceGEMState *s; int i; =20 s =3D qemu_get_nic_opaque(nc); =20 /* Do nothing if receive is not enabled. */ if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_RXENA)) { if (s->can_rx_state !=3D 1) { s->can_rx_state =3D 1; DB_PRINT("can't receive - no enable\n"); } - return 0; + return false; } =20 for (i =3D 0; i < s->num_priority_queues; i++) { if (rx_desc_get_ownership(s->rx_desc[i]) !=3D 1) { break; } }; =20 if (i =3D=3D s->num_priority_queues) { if (s->can_rx_state !=3D 2) { s->can_rx_state =3D 2; DB_PRINT("can't receive - all the buffer descriptors are busy\= n"); } - return 0; + return false; } =20 if (s->can_rx_state !=3D 0) { s->can_rx_state =3D 0; DB_PRINT("can receive\n"); } - return 1; + return true; } =20 /* * gem_update_int_status: * Raise or lower interrupt based on current status. */ diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 8a3504d962..900ba5ca65 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -414,7 +414,7 @@ static void dp8393x_do_stop_timer(dp8393xState *s) dp8393x_update_wt_regs(s); } =20 -static int dp8393x_can_receive(NetClientState *nc); +static bool dp8393x_can_receive(NetClientState *nc); =20 static void dp8393x_do_receiver_enable(dp8393xState *s) { @@ -718,13 +718,11 @@ static void dp8393x_watchdog(void *opaque) dp8393x_update_irq(s); } =20 -static int dp8393x_can_receive(NetClientState *nc) +static bool dp8393x_can_receive(NetClientState *nc) { dp8393xState *s =3D qemu_get_nic_opaque(nc); =20 - if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) - return 0; - return 1; + return !!(s->regs[SONIC_CR] & SONIC_CR_RXEN); } =20 static int dp8393x_receive_filter(dp8393xState *s, const uint8_t * buf, diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 0b833d5a15..6b89df8f0a 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -845,7 +845,7 @@ static bool e1000_has_rxbufs(E1000State *s, size_t tota= l_size) return total_size <=3D bufs * s->rxbuf_size; } =20 -static int +static bool e1000_can_receive(NetClientState *nc) { E1000State *s =3D qemu_get_nic_opaque(nc); diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index a91dbdca3c..f49fa1c7b1 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -199,7 +199,7 @@ static const MemoryRegionOps io_ops =3D { }, }; =20 -static int +static bool e1000e_nc_can_receive(NetClientState *nc) { E1000EState *s =3D qemu_get_nic_opaque(nc); diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 2f92b65d4e..041ed21017 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -562,24 +562,24 @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32= _t tx_ring, ftgmac100_update_irq(s); } =20 -static int ftgmac100_can_receive(NetClientState *nc) +static bool ftgmac100_can_receive(NetClientState *nc) { FTGMAC100State *s =3D FTGMAC100(qemu_get_nic_opaque(nc)); FTGMAC100Desc bd; =20 if ((s->maccr & (FTGMAC100_MACCR_RXDMA_EN | FTGMAC100_MACCR_RXMAC_EN)) !=3D (FTGMAC100_MACCR_RXDMA_EN | FTGMAC100_MACCR_RXMAC_EN)) { - return 0; + return false; } =20 if (ftgmac100_read_bd(&bd, s->rx_descriptor)) { - return 0; + return false; } return !(bd.des0 & FTGMAC100_RXDES0_RXPKT_RDY); } =20 /* * This is purely informative. The HW can poll the RW (and RX) ring * buffers for available descriptors but we don't need to trigger a * timer for that in qemu. */ diff --git a/hw/net/i82596.c b/hw/net/i82596.c index fe9f2390a9..e5547fa3c2 100644 --- a/hw/net/i82596.c +++ b/hw/net/i82596.c @@ -474,23 +474,23 @@ void i82596_h_reset(void *opaque) i82596_s_reset(s); } =20 -int i82596_can_receive(NetClientState *nc) +bool i82596_can_receive(NetClientState *nc) { I82596State *s =3D qemu_get_nic_opaque(nc); =20 if (s->rx_status =3D=3D RX_SUSPENDED) { - return 0; + return false; } =20 if (!s->lnkst) { - return 0; + return false; } =20 if (USE_TIMER && !timer_pending(s->flush_queue_timer)) { - return 1; + return true; } =20 - return 1; + return true; } =20 #define MIN_BUF_SIZE 60 diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 6a124a154a..5dec813d6d 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -1047,11 +1047,11 @@ static void imx_eth_write(void *opaque, hwaddr offs= et, uint64_t value, imx_eth_update(s); } =20 -static int imx_eth_can_receive(NetClientState *nc) +static bool imx_eth_can_receive(NetClientState *nc) { IMXFECState *s =3D IMX_FEC(qemu_get_nic_opaque(nc)); =20 FEC_PRINTF("\n"); =20 return !!s->regs[ENET_RDAR]; } diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c index 6b338c2f29..2ba0dc8c2f 100644 --- a/hw/net/opencores_eth.c +++ b/hw/net/opencores_eth.c @@ -349,12 +349,11 @@ static void open_eth_reset(void *opaque) open_eth_set_link_status(qemu_get_queue(s->nic)); } =20 -static int open_eth_can_receive(NetClientState *nc) +static bool open_eth_can_receive(NetClientState *nc) { OpenEthState *s =3D qemu_get_nic_opaque(nc); =20 - return GET_REGBIT(s, MODER, RXEN) && - (s->regs[TX_BD_NUM] < 0x80); + return GET_REGBIT(s, MODER, RXEN) && (s->regs[TX_BD_NUM] < 0x80); } =20 static ssize_t open_eth_receive(NetClientState *nc, diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index be9a0af629..70aca7ec26 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -793,26 +793,26 @@ static bool rtl8139_cp_rx_valid(RTL8139State *s) return !(s->RxRingAddrLO =3D=3D 0 && s->RxRingAddrHI =3D=3D 0); } =20 -static int rtl8139_can_receive(NetClientState *nc) +static bool rtl8139_can_receive(NetClientState *nc) { RTL8139State *s =3D qemu_get_nic_opaque(nc); int avail; =20 /* Receive (drop) packets if card is disabled. */ if (!s->clock_enabled) { - return 1; + return true; } if (!rtl8139_receiver_enabled(s)) { - return 1; + return true; } =20 if (rtl8139_cp_receiver_enabled(s) && rtl8139_cp_rx_valid(s)) { /* ??? Flow control not implemented in c+ mode. This is a hack to work around slirp deficiencies anyway. */ - return 1; + return true; } =20 avail =3D MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, s->RxBufferSize); return avail =3D=3D 0 || avail >=3D 1514 || (s->IntrMask & RxOverflow); } diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index 02be60c955..b3240b9335 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -667,9 +667,9 @@ static void smc91c111_writefn(void *opaque, hwaddr addr, } } =20 -static int smc91c111_can_receive_nc(NetClientState *nc) +static bool smc91c111_can_receive_nc(NetClientState *nc) { smc91c111_state *s =3D qemu_get_nic_opaque(nc); =20 return smc91c111_can_receive(s); } diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 80f5a1dd37..a2377025a7 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -110,17 +110,17 @@ typedef struct SpaprVioVlan { RxBufPool *rx_pool[RX_MAX_POOLS]; /* Receive buffer descriptor pools = */ } SpaprVioVlan; =20 -static int spapr_vlan_can_receive(NetClientState *nc) +static bool spapr_vlan_can_receive(NetClientState *nc) { SpaprVioVlan *dev =3D qemu_get_nic_opaque(nc); =20 - return (dev->isopen && dev->rx_bufs > 0); + return dev->isopen && dev->rx_bufs > 0; } =20 /** * The last 8 bytes of the receive buffer list page (that has been * supplied by the guest with the H_REGISTER_LOGICAL_LAN call) contain * a counter for frames that have been dropped because there was no * suitable receive buffer available. This function is used to increase * this counter by one. */ diff --git a/hw/net/sungem.c b/hw/net/sungem.c index 89da51f7f6..b01197d952 100644 --- a/hw/net/sungem.c +++ b/hw/net/sungem.c @@ -433,31 +433,31 @@ static bool sungem_rx_full(SunGEMState *s, uint32_t k= ick, uint32_t done) return kick =3D=3D ((done + 1) & s->rx_mask); } =20 -static int sungem_can_receive(NetClientState *nc) +static bool sungem_can_receive(NetClientState *nc) { SunGEMState *s =3D qemu_get_nic_opaque(nc); uint32_t kick, done, rxdma_cfg, rxmac_cfg; bool full; =20 rxmac_cfg =3D s->macregs[MAC_RXCFG >> 2]; rxdma_cfg =3D s->rxdmaregs[RXDMA_CFG >> 2]; =20 /* If MAC disabled, can't receive */ if ((rxmac_cfg & MAC_RXCFG_ENAB) =3D=3D 0) { trace_sungem_rx_mac_disabled(); - return 0; + return false; } if ((rxdma_cfg & RXDMA_CFG_ENABLE) =3D=3D 0) { trace_sungem_rx_txdma_disabled(); - return 0; + return false; } =20 /* Check RX availability */ kick =3D s->rxdmaregs[RXDMA_KICK >> 2]; done =3D s->rxdmaregs[RXDMA_DONE >> 2]; full =3D sungem_rx_full(s, kick, done); =20 trace_sungem_rx_check(!full, kick, done); =20 return !full; } diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 8863601f6c..9c38583180 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -657,11 +657,11 @@ static void sunhme_transmit(SunHMEState *s) sunhme_update_irq(s); } =20 -static int sunhme_can_receive(NetClientState *nc) +static bool sunhme_can_receive(NetClientState *nc) { SunHMEState *s =3D qemu_get_nic_opaque(nc); =20 - return s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE; + return !!(s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE); } =20 static void sunhme_link_status_changed(NetClientState *nc) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 3627bb1717..a46e3b37a7 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1234,26 +1234,26 @@ static void virtio_net_handle_rx(VirtIODevice *vdev= , VirtQueue *vq) qemu_flush_queued_packets(qemu_get_subqueue(n->nic, queue_index)); } =20 -static int virtio_net_can_receive(NetClientState *nc) +static bool virtio_net_can_receive(NetClientState *nc) { VirtIONet *n =3D qemu_get_nic_opaque(nc); VirtIODevice *vdev =3D VIRTIO_DEVICE(n); VirtIONetQueue *q =3D virtio_net_get_subqueue(nc); =20 if (!vdev->vm_running) { - return 0; + return false; } =20 if (nc->queue_index >=3D n->curr_queues) { - return 0; + return false; } =20 if (!virtio_queue_ready(q->rx_vq) || !(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { - return 0; + return false; } =20 - return 1; + return true; } =20 static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index cf07e698b3..71d16fef3d 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -175,10 +175,10 @@ static const MemoryRegionOps eth_ops =3D { } }; =20 -static int eth_can_rx(NetClientState *nc) +static bool eth_can_rx(NetClientState *nc) { struct xlx_ethlite *s =3D qemu_get_nic_opaque(nc); unsigned int rxbase =3D s->rxbuf * (0x800 / 4); =20 return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); } diff --git a/net/filter-buffer.c b/net/filter-buffer.c index 88da78f821..12e0254287 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -59,28 +59,28 @@ static void filter_buffer_release_timer(void *opaque) /* filter APIs */ static ssize_t filter_buffer_receive_iov(NetFilterState *nf, NetClientState *sender, unsigned flags, const struct iovec *iov, int iovcnt, NetPacketSent *sent_cb) { FilterBufferState *s =3D FILTER_BUFFER(nf); =20 /* * We return size when buffer a packet, the sender will take it as * a already sent packet, so sent_cb should not be called later. * * FIXME: Even if the guest can't receive packets for some reasons, * the filter can still accept packets until its internal queue is ful= l. * For example: * For some reason, receiver could not receive more packets - * (.can_receive() returns zero). Without a filter, at most one packet + * (.can_receive() returns false). Without a filter, at most one packet * will be queued in incoming queue and sender's poll will be disabled * unit its sent_cb() was called. With a filter, it will keep receiving * the packets without caring about the receiver. This is suboptimal. * May need more thoughts (e.g keeping sent_cb). */ qemu_net_queue_append_iov(s->incoming_queue, sender, flags, iov, iovcnt, NULL); return iov_size(iov, iovcnt); } diff --git a/net/hub.c b/net/hub.c index 5795a678ed..e7de173171 100644 --- a/net/hub.c +++ b/net/hub.c @@ -90,23 +90,23 @@ static NetHub *net_hub_new(int id) return hub; } =20 -static int net_hub_port_can_receive(NetClientState *nc) +static bool net_hub_port_can_receive(NetClientState *nc) { NetHubPort *port; NetHubPort *src_port =3D DO_UPCAST(NetHubPort, nc, nc); NetHub *hub =3D src_port->hub; =20 QLIST_FOREACH(port, &hub->ports, next) { if (port =3D=3D src_port) { continue; } =20 if (qemu_can_send_packet(&port->nc)) { - return 1; + return true; } } =20 - return 0; + return false; } =20 static ssize_t net_hub_port_receive(NetClientState *nc, --=20 2.21.1 From nobody Thu Nov 13 23:13:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583431250; cv=none; d=zohomail.com; s=zohoarc; b=E3GRINomMJqAZ1ZJnUZ0l+ATeAcv+XPrRf/KIWO5iCfXvCUOkHJLX0EjWUYLH/M3nbMPmglhkiOJkvKx2srHQxUwyF3NPh1IGC08X0fq/XdRixn5xXBRh+p9Oqm6Iit1rr4VQ+ABeTQonJmO3N6L3ie0WpIZ/j6cMUdiOTB3C/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583431250; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WcfrRNhhNXvEb5Fsa8YSfU5JUFSi8stcMlq7fuF9rdY=; b=OIp5hxJhXog1VigeiYzGr4rJjE8VDZyEZhqS1MZeAIUVfpJkusKXwaEZgdzc6asMbu7EkBzeMaP/Rf6jx+n7Zyb1qlhVOYaTdZwoyfYCBcBZ2nvrI8cl8jdizMkMtWiIOjqxq9zyKF8LylJmvcB7n3CMq7j5u2lysoafmmL5Z8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583431250647991.8694497372461; Thu, 5 Mar 2020 10:00:50 -0800 (PST) Received: from localhost ([::1]:54402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9unh-0004Jg-D1 for importer@patchew.org; Thu, 05 Mar 2020 13:00:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9ukV-0008C6-0C for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9ukT-0003B0-Pb for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:30 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30400 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9ukT-0003A7-Kv for qemu-devel@nongnu.org; Thu, 05 Mar 2020 12:57:29 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-XthAtOcEPYO_-llMcphPYA-1; Thu, 05 Mar 2020 12:57:27 -0500 Received: by mail-wr1-f69.google.com with SMTP id m13so2609864wrw.3 for ; Thu, 05 Mar 2020 09:57:27 -0800 (PST) Received: from x1w.redhat.com (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id q3sm9545210wmj.38.2020.03.05.09.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583431049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WcfrRNhhNXvEb5Fsa8YSfU5JUFSi8stcMlq7fuF9rdY=; b=VykcCIpQLjYvOY7BkNfI2rK2MTg+sfoOZHOjZcysjbzblhejNw+nw9fN4HaJCvL/Okk7WP 2wcdVw/RITjat9G2OJZYV2dx9+O6RFdGUMOPJUX6UpwBuSqC1WChEC+/GEpYGAXls9KzQ/ qJX0GDoPlGxtkh1PyTm5a43Ez7vJpH8= X-MC-Unique: XthAtOcEPYO_-llMcphPYA-1 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=Mt1XTfo73c5zQuFOCOurVKN5VFy185lbQ50F1P0uJNg=; b=OZ1FoAe2KIK25q7amFuDhwXtPqyB4uaMAdEhbu5HXNNL2/MmhQJYa8sfss/szoclUi T6knkGy6c/M+sRrQhGPPR4iESuEFq34stREOKIDJKgY8GmCumEKYe36J35M7adEY6qsB ew+xxFURS3ypVRkfPNGAkhA2DzZA/QHgFp8QyP5bgCH+hCoIaUI3SkChcpRlIiXGVmFU ftMUJihwjD1woN67bNmd66IzjSh4jSM/oRaOECofZnJjGeTm0OPWcT7TEYvPXWgWPyqP mZh5pLlOydaF0in3mUrwP+KjkN3dM6QssRTj7RFZ7WawPOC0DnanTwP6m6/kM26kYlxc Fs6Q== X-Gm-Message-State: ANhLgQ0L3veRf7kHX9IRrexe6nVQvYyYRo1EAl1TsqPTqecrQUStacxr 6jl4CnFLkRedvzgFXDhKLplAJCeZw9NDJvWs8Esn2bm9vLvjHwFSbqbTl8MBw8L5P4dw66KjGRe HYlhqCzCtekkV/HY= X-Received: by 2002:a05:600c:301:: with SMTP id q1mr11021037wmd.182.1583431044210; Thu, 05 Mar 2020 09:57:24 -0800 (PST) X-Google-Smtp-Source: ADFU+vvpSsAuRNIRWDFI9KBcRbWOUJFR4P0DhG3CflzNt8axmmml7Br4FITbn9yy8XmJbX93mHD63Q== X-Received: by 2002:a05:600c:301:: with SMTP id q1mr11021018wmd.182.1583431044028; Thu, 05 Mar 2020 09:57:24 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 6/6] hw/net/can: Make CanBusClientInfo::can_receive() return a boolean Date: Thu, 5 Mar 2020 18:56:50 +0100 Message-Id: <20200305175651.4563-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305175651.4563-1-philmd@redhat.com> References: <20200305175651.4563-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Dmitry Fleytman , Peter Maydell , "Michael S. Tsirkin" , Andrew Jeffery , Jason Wang , Alistair Francis , Joel Stanley , Beniamino Galvani , Max Filippov , qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" The CanBusClientInfo::can_receive handler return whether the device can or can not receive new frames. Make it obvious by returning a boolean type. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: C=C3=A9dric Le Goater --- hw/net/can/can_sja1000.h | 2 +- include/net/can_emu.h | 2 +- hw/net/can/can_sja1000.c | 8 ++++---- net/can/can_socketcan.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/net/can/can_sja1000.h b/hw/net/can/can_sja1000.h index 220a622087..7ca9cd681e 100644 --- a/hw/net/can/can_sja1000.h +++ b/hw/net/can/can_sja1000.h @@ -137,7 +137,7 @@ void can_sja_disconnect(CanSJA1000State *s); =20 int can_sja_init(CanSJA1000State *s, qemu_irq irq); =20 -int can_sja_can_receive(CanBusClientState *client); +bool can_sja_can_receive(CanBusClientState *client); =20 ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames, size_t frames_cnt); diff --git a/include/net/can_emu.h b/include/net/can_emu.h index d4fc51b57d..fce9770928 100644 --- a/include/net/can_emu.h +++ b/include/net/can_emu.h @@ -83,7 +83,7 @@ typedef struct CanBusClientState CanBusClientState; typedef struct CanBusState CanBusState; =20 typedef struct CanBusClientInfo { - int (*can_receive)(CanBusClientState *); + bool (*can_receive)(CanBusClientState *); ssize_t (*receive)(CanBusClientState *, const struct qemu_can_frame *frames, size_t frames_cnt); } CanBusClientInfo; diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 39c78faf9b..ea915a023a 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -733,21 +733,21 @@ uint64_t can_sja_mem_read(CanSJA1000State *s, hwaddr = addr, unsigned size) return temp; } =20 -int can_sja_can_receive(CanBusClientState *client) +bool can_sja_can_receive(CanBusClientState *client) { CanSJA1000State *s =3D container_of(client, CanSJA1000State, bus_clien= t); =20 if (s->clock & 0x80) { /* PeliCAN Mode */ if (s->mode & 0x01) { /* reset mode. */ - return 0; + return false; } } else { /* BasicCAN mode */ if (s->control & 0x01) { - return 0; + return false; } } =20 - return 1; /* always return 1, when operation mode */ + return true; /* always return true, when operation mode */ } =20 ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *f= rames, diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index 29bfacd4f8..807f31fcde 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -110,9 +110,9 @@ static void can_host_socketcan_read(void *opaque) } } =20 -static int can_host_socketcan_can_receive(CanBusClientState *client) +static bool can_host_socketcan_can_receive(CanBusClientState *client) { - return 1; + return true; } =20 static ssize_t can_host_socketcan_receive(CanBusClientState *client, --=20 2.21.1