From patchwork Thu Jan 3 14:52:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fred.konrad@greensocs.com X-Patchwork-Id: 209268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 99E9C2C0085 for ; Fri, 4 Jan 2013 01:54:33 +1100 (EST) Received: from localhost ([::1]:38614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmBj-0003K9-RZ for incoming@patchwork.ozlabs.org; Thu, 03 Jan 2013 09:54:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmAI-0008Ta-6u for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:53:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqmAG-0005WD-Df for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:53:02 -0500 Received: from greensocs.com ([87.106.252.221]:53397 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqmAG-0005Vy-5n for qemu-devel@nongnu.org; Thu, 03 Jan 2013 09:53:00 -0500 Received: from localhost (unknown [127.0.0.1]) by s15328186.onlinehome-server.info (Postfix) with ESMTP id 9092D439E3D; Thu, 3 Jan 2013 14:52:59 +0000 (UTC) Received: from s15328186.onlinehome-server.info ([127.0.0.1]) by localhost (s15328186.onlinehome-server.info [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L9RfnCaxuW4J; Thu, 3 Jan 2013 15:52:59 +0100 (CET) Received: by s15328186.onlinehome-server.info (Postfix, from userid 491) id 5E23D439E32; Thu, 3 Jan 2013 15:52:59 +0100 (CET) Received: from compaq.katmai.xl.cx.katmai.xl.cx (lan31-11-83-155-143-136.fbx.proxad.net [83.155.143.136]) by s15328186.onlinehome-server.info (Postfix) with ESMTPSA id 4BC66439E3E; Thu, 3 Jan 2013 15:52:58 +0100 (CET) From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 3 Jan 2013 15:52:22 +0100 Message-Id: <1357224744-14443-11-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357224744-14443-1-git-send-email-fred.konrad@greensocs.com> References: <1357224744-14443-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 87.106.252.221 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, e.voevodin@samsung.com, mark.burton@greensocs.com, agraf@suse.de, stefanha@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC V9 10/12] virtio-blk-s390 : switch to the new API. 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 From: KONRAD Frederic Here the virtio-blk-s390 is modified for the new API. The device virtio-blk-s390 extends virtio-s390-device as before. It creates and connects a virtio-blk during the init. The properties are not modified. Signed-off-by: KONRAD Frederic --- hw/s390-virtio-bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index 4e8471b..a2ccdc0 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -165,14 +165,20 @@ static int s390_virtio_net_init(VirtIOS390Device *dev) static int s390_virtio_blk_init(VirtIOS390Device *dev) { - VirtIODevice *vdev; - - vdev = virtio_blk_init((DeviceState *)dev, &dev->blk); - if (!vdev) { + DeviceState *vdev = DEVICE(dev->vdev); + virtio_blk_set_conf(vdev, &(dev->blk)); + qdev_set_parent_bus(vdev, BUS(dev->bus)); + if (qdev_init(vdev) < 0) { return -1; } + return s390_virtio_device_init(dev, VIRTIO_DEVICE(vdev)); +} - return s390_virtio_device_init(dev, vdev); +static void s390_virtio_blk_instance_init(Object *obj) +{ + VirtIOS390Device *dev = VIRTIO_S390_DEVICE(obj); + dev->vdev = VIRTIO_DEVICE(object_new("virtio-blk")); + object_property_add_child(obj, "virtio-backend", OBJECT(dev->vdev), NULL); } static int s390_virtio_serial_init(VirtIOS390Device *dev) @@ -436,6 +442,7 @@ static TypeInfo s390_virtio_blk = { .name = "virtio-blk-s390", .parent = TYPE_VIRTIO_S390_DEVICE, .instance_size = sizeof(VirtIOS390Device), + .instance_init = s390_virtio_blk_instance_init, .class_init = s390_virtio_blk_class_init, };