From patchwork Tue Oct 30 05:18:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10660467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC37C13A4 for ; Tue, 30 Oct 2018 05:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A224F2975D for ; Tue, 30 Oct 2018 05:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9602029AA0; Tue, 30 Oct 2018 05:23:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46A692975D for ; Tue, 30 Oct 2018 05:23:01 +0000 (UTC) Received: from localhost ([::1]:50850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHMUW-0002Nm-LA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Oct 2018 01:23:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHMQt-0005wR-Ml for qemu-devel@nongnu.org; Tue, 30 Oct 2018 01:19:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHMQt-0005jb-1J for qemu-devel@nongnu.org; Tue, 30 Oct 2018 01:19:15 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:37748) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHMQm-0005Yp-3X; Tue, 30 Oct 2018 01:19:08 -0400 Received: by mail-pl1-x641.google.com with SMTP id bh10-v6so4930754plb.4; Mon, 29 Oct 2018 22:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/yalKYo8QkxKhV0bGxdENxR9rF1fleJZX+Sx45kjEoE=; b=lr2GYoc+0J0tE1eGA+Ibi3ovuXDRbsZYPmekJB5J1mcOaLIhoyYKPs195kKhDrWCXF 2gLFNNyacfUokgQmNiOJ8rYXAVCo14nGsNlqIn6k9U/NqLX2DJNAgyHgz1VXd+ZNLd/h k59d9TM+BYiZh72+SsCDwwHdOLOQT/iieLvUCGVfn8Xybn8B4rmHorDU247eSu/Im4bd jN1JWMeelyj2SSJuvnr83uriCQ+eM55g23hPqdy43+34+m9+EWzXcu0x/Wb1GN181CFU 0jzVWaMnKSxELL5+HGPrGcMAxC14oQsXX7vHXmtGWrYYkE4tWtuU1CzXvv5BZCajZO6N E+0Q== 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; bh=/yalKYo8QkxKhV0bGxdENxR9rF1fleJZX+Sx45kjEoE=; b=jYqN3BfcqjHFA/RlNKwi4qGcR9BVTy+Cow4YKmsbI0umh2EWTE5XvBkQWwean5W2jG fc/3gdiM3WSYJkgTgpOwDZoBL+2ee/wXq8rXic/O9Y8nzZ08oWt+McVjRL5cELfXnlFO 4ESYri/wNvm/h3lRRK1DtSSlVX7A+KHGlq9ogRFyvaFeiunNvzjz0hwSh8Z/VmLaZeLh Uvfyk6kqnkXA5neuEGJiwZo1FkAK83JsWPmls7yv1Adv49E7WVzFwM2+vZCQqepONQYA Jjl7AaPfF+qBsOhbB1MCKyP3mZ38jo63VdS+O7SF/iVT+ce019mtBf7ebVR7zYKtcCoM jNLA== X-Gm-Message-State: AGRZ1gIYJMpF1ht+GFqGPT+x34tpN6nPbn/XQNd5pYV2KZFJm6m0Z68Y yoSvBAouxdneAP0PueIFj7/CZJGHUwE= X-Google-Smtp-Source: AJdET5cT5qkbf/StqJmXu3jUdewHUOIL/JS9r3uoNNL2AbE4wXQhQaoL6Z98NC4IXZenM/Ub3Ingmg== X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr10079100plz.254.1540876747354; Mon, 29 Oct 2018 22:19:07 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.65]) by smtp.gmail.com with ESMTPSA id p129-v6sm11463729pgp.92.2018.10.29.22.19.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 22:19:06 -0700 (PDT) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Mon, 29 Oct 2018 22:18:40 -0700 Message-Id: <1540876720-9574-5-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1540876720-9574-1-git-send-email-liq3ea@gmail.com> References: <1540876720-9574-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH 4/4] nvme: use pci_dev directly in nvme_realize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is no need to make another reference. Signed-off-by: Li Qiang Reviewed-by: Max Reitz --- hw/block/nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a406c23..f63e344 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1235,7 +1235,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) pci_conf[PCI_INTERRUPT_PIN] = 1; pci_config_set_prog_interface(pci_dev->config, 0x2); pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); - pcie_endpoint_cap_init(&n->parent_obj, 0x80); + pcie_endpoint_cap_init(pci_dev, 0x80); n->num_namespaces = 1; n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); @@ -1247,10 +1247,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); - pci_register_bar(&n->parent_obj, 0, + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - if (msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL)) { + if (msix_init_exclusive_bar(pci_dev, n->num_queues, 4, NULL)) { error_setg(errp, "msix_init_exclusive_bar failed"); return; } @@ -1308,7 +1308,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) n->cmbuf = g_malloc0(NVME_CMBSZ_GETSIZE(n->bar.cmbsz)); memory_region_init_io(&n->ctrl_mem, OBJECT(n), &nvme_cmb_ops, n, "nvme-cmb", NVME_CMBSZ_GETSIZE(n->bar.cmbsz)); - pci_register_bar(&n->parent_obj, NVME_CMBLOC_BIR(n->bar.cmbloc), + pci_register_bar(pci_dev, NVME_CMBLOC_BIR(n->bar.cmbloc), PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, &n->ctrl_mem);