From nobody Fri Apr 11 20:01:22 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=1585308078; cv=none; d=zohomail.com; s=zohoarc; b=FHXCOG4S1ySXLAK+YGA8DNOT/y5Cv6Ly4BV445FSPeWy8vDDv/Ms+gG8P46KL+9V5SmmauqwCqNsImdzyugNVWcgRn5P8gN1wg1+7Nefte2QSFc7J8Z+v3Z0lyNSz2Elmd6JoJTZEdTIU0/zveLOSyu7UnaEBp8QmpCUiNqmGiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585308078; 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=IfY2ZtlHiL4jateNZsER6EbnuIhItjbibF6E20oqA9o=; b=Bn0Yq0hyJniskEgg1DB09o26KZYaq1/C8U4XiFzvIvi8zB/vSJjo7uFp8BnVipu+Ztv9tlq3DognL6MuMWwOrf1xqjDWbmxbqePrPALnBcdzX6aKBpk4Evs/UDGnfNSNeU+Y0d6o51oEK73seUuIeAMBqGBnmpYvaAKE2EpowFk= 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 1585308078084912.0869923734608; Fri, 27 Mar 2020 04:21:18 -0700 (PDT) Received: from localhost ([::1]:40410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHn36-00033s-UH for importer@patchew.org; Fri, 27 Mar 2020 07:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38054) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHmwf-0001B1-KZ for qemu-devel@nongnu.org; Fri, 27 Mar 2020 07:14:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHmwe-00024d-Ee for qemu-devel@nongnu.org; Fri, 27 Mar 2020 07:14:37 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:29030) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHmwe-00024G-AN for qemu-devel@nongnu.org; Fri, 27 Mar 2020 07:14:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-Z9M-zn0fMr2xy0fQZYsb7g-1; Fri, 27 Mar 2020 07:14:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE7BA1005509; Fri, 27 Mar 2020 11:14:30 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-77.pek2.redhat.com [10.72.12.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3886E5E01F; Fri, 27 Mar 2020 11:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585307676; 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=IfY2ZtlHiL4jateNZsER6EbnuIhItjbibF6E20oqA9o=; b=FPSO6Zytbm0kTuHhLCWULsmQRmmhtwebxViGwr+UBHZK59/4Xv9aVCzPEZXFdhlXaFs5JJ kQof5dlhp2zMv47SeUBp8yvwkvmNRECA78R1IC+y0BfbMjN7WqSKAClf00djVc60SP/CdX Do5vX3KFqPZ+zNHvTJL+WL2yW3IQztI= X-MC-Unique: Z9M-zn0fMr2xy0fQZYsb7g-1 From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 09/13] hw/net/can: Make CanBusClientInfo::can_receive() return a boolean Date: Fri, 27 Mar 2020 19:14:03 +0800 Message-Id: <1585307647-24456-10-git-send-email-jasowang@redhat.com> In-Reply-To: <1585307647-24456-1-git-send-email-jasowang@redhat.com> References: <1585307647-24456-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 63.128.21.74 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: Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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" From: Philippe Mathieu-Daud=C3=A9 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 Signed-off-by: Jason Wang --- hw/net/can/can_sja1000.c | 8 ++++---- hw/net/can/can_sja1000.h | 2 +- include/net/can_emu.h | 2 +- net/can/can_socketcan.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 39c78fa..ea915a0 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/hw/net/can/can_sja1000.h b/hw/net/can/can_sja1000.h index 220a622..7ca9cd6 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 d4fc51b..fce9770 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/net/can/can_socketcan.c b/net/can/can_socketcan.c index 29bfacd..807f31f 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.5.0