From patchwork Tue Jul 6 15:33:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 58044 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 A4B22B6EEF for ; Wed, 7 Jul 2010 02:03:23 +1000 (EST) Received: from localhost ([127.0.0.1]:34882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWAcC-0006Ov-Ly for incoming@patchwork.ozlabs.org; Tue, 06 Jul 2010 12:03:20 -0400 Received: from [140.186.70.92] (port=39449 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWA9h-0006RA-JG for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWA9g-0000Ay-El for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48500) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWA9g-0000Am-6F for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:52 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o66FXo2v027614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Jul 2010 11:33:50 -0400 Received: from localhost.localdomain (dhcp-5-217.str.redhat.com [10.32.5.217]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o66FXTsv012071; Tue, 6 Jul 2010 11:33:49 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Tue, 6 Jul 2010 17:33:23 +0200 Message-Id: <1278430406-18667-15-git-send-email-kwolf@redhat.com> In-Reply-To: <1278430406-18667-1-git-send-email-kwolf@redhat.com> References: <1278430406-18667-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 14/17] ide: Make ide_init_drive() return success 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 From: Markus Armbruster It still always succeeds. The next commits will add failures. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- hw/ide/core.c | 13 +++++++++---- hw/ide/internal.h | 4 ++-- hw/ide/qdev.c | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 58b88ee..dbb7acc 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -26,6 +26,7 @@ #include #include #include +#include "qemu-error.h" #include "qemu-timer.h" #include "sysemu.h" #include "dma.h" @@ -2594,8 +2595,8 @@ void ide_bus_reset(IDEBus *bus) ide_clear_hob(bus); } -void ide_init_drive(IDEState *s, BlockDriverState *bs, - const char *version, const char *serial) +int ide_init_drive(IDEState *s, BlockDriverState *bs, + const char *version, const char *serial) { int cylinders, heads, secs; uint64_t nb_sectors; @@ -2630,6 +2631,7 @@ void ide_init_drive(IDEState *s, BlockDriverState *bs, } ide_reset(s); bdrv_set_removable(bs, s->drive_kind == IDE_CD); + return 0; } static void ide_init1(IDEBus *bus, int unit) @@ -2669,8 +2671,11 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, dinfo = i == 0 ? hd0 : hd1; ide_init1(bus, i); if (dinfo) { - ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL, - *dinfo->serial ? dinfo->serial : NULL); + if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL, + *dinfo->serial ? dinfo->serial : NULL) < 0) { + error_report("Can't set up IDE drive %s", dinfo->id); + exit(1); + } } else { ide_reset(&bus->ifs[i]); } diff --git a/hw/ide/internal.h b/hw/ide/internal.h index bd53660..4165543 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -556,8 +556,8 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr); void ide_data_writel(void *opaque, uint32_t addr, uint32_t val); uint32_t ide_data_readl(void *opaque, uint32_t addr); -void ide_init_drive(IDEState *s, BlockDriverState *bs, - const char *version, const char *serial); +int ide_init_drive(IDEState *s, BlockDriverState *bs, + const char *version, const char *serial); void ide_init2(IDEBus *bus, qemu_irq irq); void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, qemu_irq irq); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 221f387..53468ed 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -118,7 +118,9 @@ static int ide_drive_initfn(IDEDevice *dev) } } - ide_init_drive(s, dev->conf.bs, dev->version, serial); + if (ide_init_drive(s, dev->conf.bs, dev->version, serial) < 0) { + return -1; + } if (!dev->version) { dev->version = qemu_strdup(s->version);