From patchwork Tue Dec 15 15:09:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 41191 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 65AB3B7093 for ; Wed, 16 Dec 2009 02:10:56 +1100 (EST) Received: from localhost ([127.0.0.1]:44296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKZ37-00059B-CH for incoming@patchwork.ozlabs.org; Tue, 15 Dec 2009 10:10:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKZ1q-0004Bp-56 for qemu-devel@nongnu.org; Tue, 15 Dec 2009 10:09:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKZ1i-00043s-Pj for qemu-devel@nongnu.org; Tue, 15 Dec 2009 10:09:30 -0500 Received: from [199.232.76.173] (port=33248 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKZ1i-00043L-8h for qemu-devel@nongnu.org; Tue, 15 Dec 2009 10:09:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37319) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NKZ1g-0005eG-H1 for qemu-devel@nongnu.org; Tue, 15 Dec 2009 10:09:25 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBFF9Lrg004586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Dec 2009 10:09:21 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-197.ams2.redhat.com [10.36.9.197]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBFF9Jwd019117; Tue, 15 Dec 2009 10:09:20 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id C751070FB8; Tue, 15 Dec 2009 16:09:17 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 15 Dec 2009 16:09:16 +0100 Message-Id: <1260889756-26864-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [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 11ea439..2e5c7a1 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1885,8 +1885,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); @@ -1904,8 +1906,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); @@ -1921,7 +1925,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;