From patchwork Thu Dec 24 08:09:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 41743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0EABCB7BF8 for ; Thu, 24 Dec 2009 19:27:38 +1100 (EST) Received: from localhost ([127.0.0.1]:53532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNj2l-0000bK-9c for incoming@patchwork.ozlabs.org; Thu, 24 Dec 2009 03:27:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNilQ-000235-AC for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:09:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNilE-0001vp-Rv for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:09:33 -0500 Received: from [199.232.76.173] (port=42920 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNilE-0001vB-6m for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:09:28 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:39717) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNilD-0004Uf-St for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:09:28 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 941A7106AB4; Thu, 24 Dec 2009 17:09:21 +0900 (JST) Received: (nullmailer pid 22817 invoked by uid 1000); Thu, 24 Dec 2009 08:09:20 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Thu, 24 Dec 2009 17:09:10 +0900 Message-Id: <1261642160-22754-18-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.5.4 In-Reply-To: <1261642160-22754-1-git-send-email-yamahata@valinux.co.jp> References: <1261642160-22754-1-git-send-email-yamahata@valinux.co.jp> X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH V10 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Split out pci device initialization from pc_init1() into pc_pci_device_init(). and removed unnecessary braces. Signed-off-by: Isaku Yamahata --- hw/pc.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 3c01df8..03cc8db 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1180,6 +1180,24 @@ static void pc_basic_device_init(qemu_irq *isa_irq, *floppy_controller = fdctrl_init_isa(fd); } +static void pc_pci_device_init(PCIBus *pci_bus) +{ + int i; + int max_bus; + + max_bus = drive_get_max_bus(IF_SCSI); + for (i = 0; i <= max_bus; i++) { + pci_create_simple(pci_bus, -1, "lsi53c895a"); + } + + /* Add virtio console devices */ + for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { + if (virtcon_hds[i]) { + pci_create_simple(pci_bus, -1, "virtio-console-pci"); + } + } +} + /* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size, const char *boot_device, @@ -1299,22 +1317,7 @@ static void pc_init1(ram_addr_t ram_size, } if (pci_enabled) { - int max_bus; - int bus; - - max_bus = drive_get_max_bus(IF_SCSI); - for (bus = 0; bus <= max_bus; bus++) { - pci_create_simple(pci_bus, -1, "lsi53c895a"); - } - } - - /* Add virtio console devices */ - if (pci_enabled) { - for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { - if (virtcon_hds[i]) { - pci_create_simple(pci_bus, -1, "virtio-console-pci"); - } - } + pc_pci_device_init(pci_bus); } rom_load_fw(fw_cfg);