From nobody Mon May 20 17:29:56 2024 Delivered-To: importer@patchew.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=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645138596167838.4065364843499; Thu, 17 Feb 2022 14:56:36 -0800 (PST) Received: from localhost ([::1]:45668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKphR-0007XD-LQ for importer@patchew.org; Thu, 17 Feb 2022 17:56:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKpf2-0005K7-RP for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:04 -0500 Received: from [2a00:1450:4864:20::62b] (port=37764 helo=mail-ej1-x62b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKpf1-0003wx-0J for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:04 -0500 Received: by mail-ej1-x62b.google.com with SMTP id bg10so10704781ejb.4 for ; Thu, 17 Feb 2022 14:54:01 -0800 (PST) Received: from Provence.localdomain (dynamic-077-183-198-236.77.183.pool.telefonica.de. [77.183.198.236]) by smtp.gmail.com with ESMTPSA id mb23sm1598871ejb.62.2022.02.17.14.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 14:53:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lhtn+Z5Nrnw2Yi/2S9qOoxlDL8t9OmWsXOw8nKk+Z7k=; b=h4PvnpAb5bcrmGVCBcxbKp2n6Nllu+YADmBWYBlvvI8bxRcB++Y2GsbWjL+uCS8dQL JyCu0mppJNeEaRKqhLU4PtxMJFHlplysrLqBCykT3dtyF0wUqKLvgn4ZXIjq9QMO8qGS DvRCk+LtJa10LeNzucTeNP9dWgiocJBwOS4FFC1lf3qjVlNnSLfELRMwoBlej1Rwjb4A +I6eFn30wm1EAoM8YMPoy2AlmNLaDdsjMS1QmPh95YxVVH3GHQxg37S+IgeXOcHKvcGq u7TVB9Lzrfb/Af13NUeWdDBJI+rbWJ4/eOYQFdaLMRJQ68VJPrPPhRh62ZutSd1e17vV DjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lhtn+Z5Nrnw2Yi/2S9qOoxlDL8t9OmWsXOw8nKk+Z7k=; b=pGaU63O0GfK3dlNkPOIMl1lKoLKnBbAlotOXY46OjccIYbzQ8seDG76VQuM3pXotI+ ETGxCoD9/Gf1MLmd5x7mN0xRZXg6yoaeE07nuuamtXVIiKiRsP5s/Zno81Z5p/+58cM9 z0InbGGgGiXwlubND4ic9mPx/6M54efhEEwbOikb/fY+/dhmB+wZ+InsU4x9HNTRoAYR /FipQhd8HecsmBEHcgg9zuhGGGqLCGdMdFf1E1HqxXVq8M6UInssaq96yUsZ0S49ne/H vur/+Mwg+QS0vKvu0NwPwjKkavmVndZLrvbG+HRlztURZeo1kAZSUUy3kn6LYKu6BS5C ltjA== X-Gm-Message-State: AOAM5332conh7wybG05TtwBC+ikYorfWWN2xx30HH/Tb7o33nEbWaeJK hhUoAQmfKdHa0mlEehhTUyEoQAl66LrmjQ== X-Google-Smtp-Source: ABdhPJxzVjgpmWttgIiTKYpfhpbUaISrDVRwQq4sTms6WZ4nQYo8LJ2ecMNNkf0y8n3JbJ01N6n32w== X-Received: by 2002:a17:906:16cc:b0:6ce:e607:ff02 with SMTP id t12-20020a17090616cc00b006cee607ff02mr3960511ejd.418.1645138440308; Thu, 17 Feb 2022 14:54:00 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Subject: [PATCH 1/2] hw/vfio/pci-quirks: Resolve redundant property getters Date: Thu, 17 Feb 2022 23:53:49 +0100 Message-Id: <20220217225351.140095-2-shentey@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220217225351.140095-1-shentey@gmail.com> References: <20220217225351.140095-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::62b (failed) 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; Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Williamson , Bernhard Beschow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645138597797100001 Content-Type: text/plain; charset="utf-8" The QOM API already provides getters for uint64 and uint32 values, so reuse them. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/vfio/pci-quirks.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 0cf69a8c6d..f0147a050a 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1565,22 +1565,6 @@ static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *= vdev, Error **errp) return 0; } =20 -static void vfio_pci_nvlink2_get_tgt(Object *obj, Visitor *v, - const char *name, - void *opaque, Error **errp) -{ - uint64_t tgt =3D (uintptr_t) opaque; - visit_type_uint64(v, name, &tgt, errp); -} - -static void vfio_pci_nvlink2_get_link_speed(Object *obj, Visitor *v, - const char *name, - void *opaque, Error **err= p) -{ - uint32_t link_speed =3D (uint32_t)(uintptr_t) opaque; - visit_type_uint32(v, name, &link_speed, errp); -} - int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp) { int ret; @@ -1618,9 +1602,9 @@ int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev= , Error **errp) nv2reg->size, p); QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); =20 - object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", - vfio_pci_nvlink2_get_tgt, NULL, NULL, - (void *) (uintptr_t) cap->tgt); + object_property_add_uint64_ptr(OBJECT(vdev), "nvlink2-tgt", + (uint64_t *) &cap->tgt, + OBJ_PROP_FLAG_READ); trace_vfio_pci_nvidia_gpu_setup_quirk(vdev->vbasedev.name, cap->tgt, nv2reg->size); free_exit: @@ -1679,15 +1663,15 @@ int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Erro= r **errp) QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); } =20 - object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", - vfio_pci_nvlink2_get_tgt, NULL, NULL, - (void *) (uintptr_t) captgt->tgt); + object_property_add_uint64_ptr(OBJECT(vdev), "nvlink2-tgt", + (uint64_t *) &captgt->tgt, + OBJ_PROP_FLAG_READ); trace_vfio_pci_nvlink2_setup_quirk_ssatgt(vdev->vbasedev.name, captgt-= >tgt, atsdreg->size); =20 - object_property_add(OBJECT(vdev), "nvlink2-link-speed", "uint32", - vfio_pci_nvlink2_get_link_speed, NULL, NULL, - (void *) (uintptr_t) capspeed->link_speed); + object_property_add_uint32_ptr(OBJECT(vdev), "nvlink2-link-speed", + &capspeed->link_speed, + OBJ_PROP_FLAG_READ); trace_vfio_pci_nvlink2_setup_quirk_lnkspd(vdev->vbasedev.name, capspeed->link_speed); free_exit: --=20 2.35.1 From nobody Mon May 20 17:29:56 2024 Delivered-To: importer@patchew.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=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645138589405870.2241267931746; Thu, 17 Feb 2022 14:56:29 -0800 (PST) Received: from localhost ([::1]:45552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKphM-0007Sx-Qc for importer@patchew.org; Thu, 17 Feb 2022 17:56:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKpf4-0005KN-2w for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:06 -0500 Received: from [2a00:1450:4864:20::629] (port=46701 helo=mail-ej1-x629.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKpf1-0003x9-SS for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:05 -0500 Received: by mail-ej1-x629.google.com with SMTP id qx21so10614375ejb.13; Thu, 17 Feb 2022 14:54:03 -0800 (PST) Received: from Provence.localdomain (dynamic-077-183-198-236.77.183.pool.telefonica.de. [77.183.198.236]) by smtp.gmail.com with ESMTPSA id mb23sm1598871ejb.62.2022.02.17.14.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 14:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fRlSqQPzztWpXDOsBI/n8vm223cY5mt64tT7JGeMEVY=; b=WALMoUBa3GnbcoiVWR6ZatTUDmxBdfLzOUeSF5pAl3HzaVayj3BmRZ6cfchm4GTDIg uwZSPeG9f/5eSitBi5SBiqkBrsGiWG0CVz4ZOALChX3fY7u7M+QIfkL2EjYGtyf+QFu9 vQ8FoOBxDie3xXrjU2CdMjSASzk4SRUtkCFt+3vekn/AMnspv1d0xRWSi9t6W8K43ZIp fhEAY5t2dp6qYGxuANLSaObbG99hqptSxh/pcKYvsrT4ELHiUg9vSB/cyonE4uGudXYz mt5OL6c1VFvapjZiom2fUNrJa+/iViEoQJ+Xv0sFa74AHnj+bBJ3xxDEgHmylx3rCUMC lxGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fRlSqQPzztWpXDOsBI/n8vm223cY5mt64tT7JGeMEVY=; b=fzwhAg18cKixMPOHDWJ1AxdpA1JWw3ks9YW0n+jZIVg5tazh6ANRXJDY9CLKXKl84u uClZASfx0fq9wOzu/RWfBBVnWKTMHK+mOgcQLzQ6JcmdHtSFAnkgwhaEmct9ZoW2NAc9 0FD1tyR57g4mMPIkS0+s7ahlZFC60TExC6CpUp0Hc6nO1Ovmr84J+vukZKzEFxV9Ym3O C6iWtoPDyhu/F5G4q3NPIKAuQE5Aj/j0aOrYq+ZtoeQzpIhvI5Qy630d3T39o7z5N2Mu A802S46Ak88PiVB9u1SIGIiskvfUW9YkLzAhcKfwvHkR3Tt5h4D8brwxjXr2tWJzsCjw GV1w== X-Gm-Message-State: AOAM533s5CKTtfkuObrSkyOsyZFNPTWjhZ/zHRq1QmoMVL1ePpnlTR7A ZwrhLRgxGlFTFAnyj8aFU9Hx1nQpkOLQIg== X-Google-Smtp-Source: ABdhPJxxQ/4h522NJRoTK1rfkAlGURA55n5+lJkFU1N6XIlBcI/cq1XSOodxfuPN8ryHvmyw3qNX4g== X-Received: by 2002:a17:906:53c7:b0:6ce:6f32:ce53 with SMTP id p7-20020a17090653c700b006ce6f32ce53mr4156328ejo.352.1645138442275; Thu, 17 Feb 2022 14:54:02 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Subject: [PATCH 2/2] hw/riscv/sifive_u: Resolve redundant property accessors Date: Thu, 17 Feb 2022 23:53:51 +0100 Message-Id: <20220217225351.140095-4-shentey@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220217225351.140095-1-shentey@gmail.com> References: <20220217225351.140095-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::629 (failed) 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; Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=shentey@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , Bin Meng , Bernhard Beschow , Palmer Dabbelt , "open list:SiFive Machines" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645138592106100001 Content-Type: text/plain; charset="utf-8" The QOM API already provides accessors for uint32 values, so reuse them. Signed-off-by: Bernhard Beschow Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/sifive_u.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 7fbc7dea42..747eb4ee89 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -713,36 +713,20 @@ static void sifive_u_machine_set_start_in_flash(Objec= t *obj, bool value, Error * s->start_in_flash =3D value; } =20 -static void sifive_u_machine_get_uint32_prop(Object *obj, Visitor *v, - const char *name, void *opaqu= e, - Error **errp) -{ - visit_type_uint32(v, name, (uint32_t *)opaque, errp); -} - -static void sifive_u_machine_set_uint32_prop(Object *obj, Visitor *v, - const char *name, void *opaqu= e, - Error **errp) -{ - visit_type_uint32(v, name, (uint32_t *)opaque, errp); -} - static void sifive_u_machine_instance_init(Object *obj) { SiFiveUState *s =3D RISCV_U_MACHINE(obj); =20 s->start_in_flash =3D false; s->msel =3D 0; - object_property_add(obj, "msel", "uint32", - sifive_u_machine_get_uint32_prop, - sifive_u_machine_set_uint32_prop, NULL, &s->msel); + object_property_add_uint32_ptr(obj, "msel", &s->msel, + OBJ_PROP_FLAG_READWRITE); object_property_set_description(obj, "msel", "Mode Select (MSEL[3:0]) pin state"); =20 s->serial =3D OTP_SERIAL; - object_property_add(obj, "serial", "uint32", - sifive_u_machine_get_uint32_prop, - sifive_u_machine_set_uint32_prop, NULL, &s->serial= ); + object_property_add_uint32_ptr(obj, "serial", &s->serial, + OBJ_PROP_FLAG_READWRITE); object_property_set_description(obj, "serial", "Board serial number"); } =20 --=20 2.35.1 From nobody Mon May 20 17:29:56 2024 Delivered-To: importer@patchew.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=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645138694065525.2816448525837; Thu, 17 Feb 2022 14:58:14 -0800 (PST) Received: from localhost ([::1]:51054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKpj3-0002fc-4T for importer@patchew.org; Thu, 17 Feb 2022 17:58:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKpf3-0005KM-VQ for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:06 -0500 Received: from [2a00:1450:4864:20::62f] (port=42928 helo=mail-ej1-x62f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKpf1-0003x2-0a for qemu-devel@nongnu.org; Thu, 17 Feb 2022 17:54:05 -0500 Received: by mail-ej1-x62f.google.com with SMTP id hw13so10631556ejc.9 for ; Thu, 17 Feb 2022 14:54:02 -0800 (PST) Received: from Provence.localdomain (dynamic-077-183-198-236.77.183.pool.telefonica.de. [77.183.198.236]) by smtp.gmail.com with ESMTPSA id mb23sm1598871ejb.62.2022.02.17.14.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 14:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kph8jPkkP3EhAAX5EP3idyNUbCQCSMjrQBSoZfwf/qg=; b=kkbCni/Dz2RA/SKVTd2satAxQVUV4iNqrCG0olyMRhoWmruvTr6/9HhoLXB0RH/4ge UZIVlm7PpKfJ2837qXxKTP1dT1mvPZ50/C34a7C7R2znf2ZS9SBbd18Qp6HG7LvedOns oc5/48ZmgE0y+3tmMRNHxCHIaSuz0z1eTI4EZ+81UdvFKlCPncK3OsP+KBAP52pA3VAi 7M5uwn4W9GbvJjwUh8JwsfdC1znlYAzqzV2MUlzeUllGZKPgQTLtS2Ens7QXY7IHbiNe n/gDxS1lghNw47mD4xgZxy8SyrJN4Dd7reGpnW44dG3XCrusLOByrGfcj3hXc4N1TPZR kB3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kph8jPkkP3EhAAX5EP3idyNUbCQCSMjrQBSoZfwf/qg=; b=iHVGrfKRujOiAdVuVuhyXf6nvIC89apD3Wu6NdWOSBj/nc8gpJfhRt9eNWQGog5ozt fJ37clK+MzInAf5jmfDNRNf6I1cI+ozf6q0Wu8s5MvHKVFR3w+3hd6hsbZkIRqwdA0Nk S0Sobj9WGM0F1guNwkX903kWv+DUm9EOT00TUvEKevaFUn9Gr/HVREQUrpQHVdK7wHPF mj2uEdm/U/tQbAxzRvK9Mpt1HWP5TrZTVdCyanzgwrCYjPXY3YZHJP9p35GDfGP482D3 Q/5UqT+H3oBHY0V5jek62V1Ttb/BaGnJ9IvLj6aKsKXQUVXvtn4tVzNSxkbLT5z/CC72 J5iw== X-Gm-Message-State: AOAM530SxE6nySr2SRUzhEe0kGFuy+X668UwSWZUc6wKIsfGluriLBn7 mbDi5GUuusDorX/2j2t9JhmAuk21QC2vHw== X-Google-Smtp-Source: ABdhPJwYn3yJF50mBAZW4V4RSGFwi/0OrWlH4XPLvYKSCBPaBXVez6Jq5R3uZZfMkcg7x4/oii66vw== X-Received: by 2002:a17:906:3ac6:b0:6cb:6808:95f9 with SMTP id z6-20020a1709063ac600b006cb680895f9mr4199506ejd.375.1645138441453; Thu, 17 Feb 2022 14:54:01 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Subject: [PATCH] virtio/virtio-balloon: Prefer Object* over void* parameter Date: Thu, 17 Feb 2022 23:53:50 +0100 Message-Id: <20220217225351.140095-3-shentey@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220217225351.140095-1-shentey@gmail.com> References: <20220217225351.140095-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::62f (failed) 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; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=shentey@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Bernhard Beschow , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645138696284100001 Content-Type: text/plain; charset="utf-8" *opaque is an alias to *obj. Using the ladder makes the code consistent with with other devices, e.g. accel/kvm/kvm-all and accel/tcg/tcg-all. It also makes the cast more typesafe. Signed-off-by: Bernhard Beschow Reviewed-by: David Hildenbrand --- hw/virtio/virtio-balloon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 9a4f491b54..38732d4118 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -241,7 +241,7 @@ static void balloon_stats_get_all(Object *obj, Visitor = *v, const char *name, void *opaque, Error **errp) { Error *err =3D NULL; - VirtIOBalloon *s =3D opaque; + VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); int i; =20 if (!visit_start_struct(v, name, NULL, 0, &err)) { @@ -276,7 +276,7 @@ static void balloon_stats_get_poll_interval(Object *obj= , Visitor *v, const char *name, void *opaque, Error **errp) { - VirtIOBalloon *s =3D opaque; + VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); visit_type_int(v, name, &s->stats_poll_interval, errp); } =20 @@ -284,7 +284,7 @@ static void balloon_stats_set_poll_interval(Object *obj= , Visitor *v, const char *name, void *opaque, Error **errp) { - VirtIOBalloon *s =3D opaque; + VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); int64_t value; =20 if (!visit_type_int(v, name, &value, errp)) { @@ -1014,12 +1014,12 @@ static void virtio_balloon_instance_init(Object *ob= j) s->free_page_hint_notify.notify =3D virtio_balloon_free_page_hint_noti= fy; =20 object_property_add(obj, "guest-stats", "guest statistics", - balloon_stats_get_all, NULL, NULL, s); + balloon_stats_get_all, NULL, NULL, NULL); =20 object_property_add(obj, "guest-stats-polling-interval", "int", balloon_stats_get_poll_interval, balloon_stats_set_poll_interval, - NULL, s); + NULL, NULL); } =20 static const VMStateDescription vmstate_virtio_balloon =3D { --=20 2.35.1