From nobody Tue Feb 10 06:27:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1609868826; cv=none; d=zohomail.com; s=zohoarc; b=nGTX9DqrVIJIBl3peS0G6rwVPaStb2/eqLPeCCyOb7HPwY1qlpIpNMoxrkTHWVcnf+jeej/Z219fpTAcpEOC3h6uK+Z/kymyfM/z/4kvRPLweCHaogSwRUbT68/VqMr6p61eJc9fVOQA8CUYgdBv6Um5DYqVrqYjEBOB5PD6EXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609868826; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=K1MwrGPkpl0wTZhvU83OdsZZBnyluFntSpoxzfHcZw4=; b=bMSkaIwVmKqeHYv5NC+iUVv57xyslYR2gj01SOmRWE2AUFrLXP+dhvWscahLXWzcZgiL+t09j4W7cZPD3dmhiLtT2xpNsb6FMV98PyUNowXcEAAWlNh2WQb0eC/lyF7f3+oWkhIu1jQ7Q3Fm99SCZBRrBI9aI+ZJFSj/NX8p5PM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1609868826437757.520921172953; Tue, 5 Jan 2021 09:47:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.62113.109801 (Exim 4.92) (envelope-from ) id 1kwqQ0-0005TR-5s; Tue, 05 Jan 2021 17:46:52 +0000 Received: by outflank-mailman (output) from mailman id 62113.109801; Tue, 05 Jan 2021 17:46:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwqQ0-0005TI-1D; Tue, 05 Jan 2021 17:46:52 +0000 Received: by outflank-mailman (input) for mailman id 62113; Tue, 05 Jan 2021 17:46:50 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwqPy-0005QY-2Y for xen-devel@lists.xenproject.org; Tue, 05 Jan 2021 17:46:50 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwqPx-0006IT-Ed; Tue, 05 Jan 2021 17:46:49 +0000 Received: from ec2-34-243-106-223.eu-west-1.compute.amazonaws.com ([34.243.106.223] helo=ip-10-0-70-185.eu-west-1.compute.internal) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kwqPx-0008Uy-7J; Tue, 05 Jan 2021 17:46:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=K1MwrGPkpl0wTZhvU83OdsZZBnyluFntSpoxzfHcZw4=; b=pd3UgDS6lRoHTpLQ0b54nnhKA aniOe2Zq5KlCR8r94pnJAmP+utCoUQgQ4e8y4Jstfh2OKiHy6aWe8P0J7FFE8wEP/5cvtZ50+OT6c ZQ9mTOp2tThWwb7xS3pzX/Lk2PZ7hESE/haYOPJdw8EaP/ltr9ZLdkc31RxBKhS6tBSmM=; From: Paul Durrant To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH v7 3/7] libxl: stop setting 'vdevfn' in pci_struct_fill() Date: Tue, 5 Jan 2021 17:46:38 +0000 Message-Id: <20210105174642.2754-4-paul@xen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210105174642.2754-1-paul@xen.org> References: <20210105174642.2754-1-paul@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paul Durrant There are only two call-sites. One always sets it to 0 (which is unnecessary as the structure is already initialized to zero) and the other can simply s= et the 'vdevfn' field directly (after proper structure initialization), avoidi= ng the need for a local variable. A subsequent patch will also make use of pci_struct_fill() in a context where 'vdevfn' may already have been set. Signed-off-by: Paul Durrant Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD v7: - New in v7 --- tools/libs/light/libxl_pci.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c index 74c2196ae3..6feedadc62 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -39,13 +39,12 @@ static unsigned int pci_encode_bdf(libxl_device_pci *pc= i) =20 static void pci_struct_fill(libxl_device_pci *pci, unsigned int domain, unsigned int bus, unsigned int dev, - unsigned int func, unsigned int vdevfn) + unsigned int func) { pci->domain =3D domain; pci->bus =3D bus; pci->dev =3D dev; pci->func =3D func; - pci->vdevfn =3D vdevfn; } =20 static void libxl_create_pci_backend_device(libxl__gc *gc, @@ -451,7 +450,7 @@ libxl_device_pci *libxl_device_pci_assignable_list(libx= l_ctx *ctx, int *num) new =3D pcis + *num; =20 libxl_device_pci_init(new); - pci_struct_fill(new, dom, bus, dev, func, 0); + pci_struct_fill(new, dom, bus, dev, func); =20 if (pci_info_xs_read(gc, new, "domid")) /* already assigned */ continue; @@ -2288,17 +2287,19 @@ static int libxl__device_pci_from_xs_be(libxl__gc *= gc, libxl_devid nr, void *data) { char *s; - unsigned int domain =3D 0, bus =3D 0, dev =3D 0, func =3D 0, vdevfn = =3D 0; + unsigned int domain =3D 0, bus =3D 0, dev =3D 0, func =3D 0; libxl_device_pci *pci =3D data; =20 + libxl_device_pci_init(pci); + s =3D libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/dev-%d", be_path, nr)= ); sscanf(s, PCI_BDF, &domain, &bus, &dev, &func); =20 + pci_struct_fill(pci, domain, bus, dev, func); + s =3D libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/vdevfn-%d", be_path, = nr)); if (s) - vdevfn =3D strtol(s, (char **) NULL, 16); - - pci_struct_fill(pci, domain, bus, dev, func, vdevfn); + pci->vdevfn =3D strtol(s, (char **) NULL, 16); =20 s =3D libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/opts-%d", be_path, nr= )); if (s) { --=20 2.11.0