From patchwork Mon Mar 14 10:35:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Jiangang X-Patchwork-Id: 597002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qNvMQ01Cbz9sRZ for ; Mon, 14 Mar 2016 21:37:22 +1100 (AEDT) Received: from localhost ([::1]:40021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afPsG-0007TJ-4b for incoming@patchwork.ozlabs.org; Mon, 14 Mar 2016 06:37:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afPqu-0005SZ-9O for qemu-devel@nongnu.org; Mon, 14 Mar 2016 06:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afPqs-0000jT-9z for qemu-devel@nongnu.org; Mon, 14 Mar 2016 06:35:56 -0400 Received: from [59.151.112.132] (port=16544 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afPqr-0000iW-U4 for qemu-devel@nongnu.org; Mon, 14 Mar 2016 06:35:54 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4549234" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Mar 2016 18:35:44 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id AA31042B4B03; Mon, 14 Mar 2016 18:35:41 +0800 (CST) Received: from localhost.localdomain (10.167.226.50) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 14 Mar 2016 18:40:19 +0800 From: Wei Jiangang To: Date: Mon, 14 Mar 2016 18:35:04 +0800 Message-ID: <1457951704-5217-4-git-send-email-weijg.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1457951704-5217-1-git-send-email-weijg.fnst@cn.fujitsu.com> References: <1457951704-5217-1-git-send-email-weijg.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.50] X-yoursite-MailScanner-ID: AA31042B4B03.AE8F5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: weijg.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: marcel@redhat.com, caoj.fnst@cn.fujitsu.com, Wei Jiangang , ehabkost@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 3/3] pxb-pcie: convert to realize() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Wei Jiangang Signed-off-by: Cao jin --- hw/pci-bridge/pci_expander_bridge.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index cc5074d..64267d8 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -314,22 +314,14 @@ static const TypeInfo pxb_dev_info = { .class_init = pxb_dev_class_init, }; -static int pxb_pcie_dev_initfn(PCIDevice *dev) +static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp) { - Error *err = NULL; - if (!pci_bus_is_express(dev->bus)) { - error_report("pxb-pcie devices cannot reside on a PCI bus!"); - return -EINVAL; - } - - pxb_dev_realize_common(dev, true, &err); - if (err) { - error_report_err(err); - return -EINVAL; + error_setg(errp, "pxb-pcie devices cannot reside on a PCI bus!"); + return; } - return 0; + pxb_dev_realize_common(dev, true, errp); } static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data) @@ -337,7 +329,7 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->init = pxb_pcie_dev_initfn; + k->realize = pxb_pcie_dev_realize; k->exit = pxb_dev_exitfn; k->vendor_id = PCI_VENDOR_ID_REDHAT; k->device_id = PCI_DEVICE_ID_REDHAT_PXB_PCIE;