From patchwork Wed Jan 6 14:23:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 42297 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 005D0B6EEF for ; Thu, 7 Jan 2010 01:24:14 +1100 (EST) Received: from localhost ([127.0.0.1]:59017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSWnz-00017b-W5 for incoming@patchwork.ozlabs.org; Wed, 06 Jan 2010 09:24:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSWn9-00010K-QD for qemu-devel@nongnu.org; Wed, 06 Jan 2010 09:23:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSWn5-0000yW-5s for qemu-devel@nongnu.org; Wed, 06 Jan 2010 09:23:19 -0500 Received: from [199.232.76.173] (port=48760 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSWn4-0000yS-To for qemu-devel@nongnu.org; Wed, 06 Jan 2010 09:23:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32648) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSWn4-00037H-Dr for qemu-devel@nongnu.org; Wed, 06 Jan 2010 09:23:14 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o06ENCXW029890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Jan 2010 09:23:13 -0500 Received: from zweiblum.home.kraxel.org (vpn2-11-33.ams2.redhat.com [10.36.11.33]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o06ENBie005336; Wed, 6 Jan 2010 09:23:12 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id D245270FCA; Wed, 6 Jan 2010 15:23:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 6 Jan 2010 15:23:10 +0100 Message-Id: <1262787790-27764-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [FOR 0.12 RESEND PATCH] fdc: fix drive property handling. 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 Fix the floppy controller init wrappers to set the drive properties only in case the DriveInfo pointers passed in are non NULL. This allows to set the properties using -global. Signed-off-by: Gerd Hoffmann --- hw/fdc.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index 0579b03..691374e 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1860,8 +1860,10 @@ fdctrl_t *fdctrl_init_isa(DriveInfo **fds) ISADevice *dev; dev = isa_create("isa-fdc"); - qdev_prop_set_drive(&dev->qdev, "driveA", fds[0]); - qdev_prop_set_drive(&dev->qdev, "driveB", fds[1]); + if (fds[0]) + qdev_prop_set_drive(&dev->qdev, "driveA", fds[0]); + if (fds[1]) + qdev_prop_set_drive(&dev->qdev, "driveB", fds[1]); if (qdev_init(&dev->qdev) < 0) return NULL; return &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state); @@ -1879,8 +1881,10 @@ fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); fdctrl = &sys->state; fdctrl->dma_chann = dma_chann; /* FIXME */ - qdev_prop_set_drive(dev, "driveA", fds[0]); - qdev_prop_set_drive(dev, "driveB", fds[1]); + if (fds[0]) + qdev_prop_set_drive(dev, "driveA", fds[0]); + if (fds[1]) + qdev_prop_set_drive(dev, "driveB", fds[1]); qdev_init_nofail(dev); sysbus_connect_irq(&sys->busdev, 0, irq); sysbus_mmio_map(&sys->busdev, 0, mmio_base); @@ -1896,7 +1900,8 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base, fdctrl_t *fdctrl; dev = qdev_create(NULL, "SUNW,fdtwo"); - qdev_prop_set_drive(dev, "drive", fds[0]); + if (fds[0]) + qdev_prop_set_drive(dev, "drive", fds[0]); qdev_init_nofail(dev); sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); fdctrl = &sys->state;