From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKbA-0003iD-N8 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:52:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmKb6-0000eQ-T7 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:52:00 -0400 Received: from e06smtp09.uk.ibm.com ([195.75.94.105]:50747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKb6-0000dc-LG for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:51:56 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Oct 2015 12:51:55 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id DC0712190046 for ; Wed, 14 Oct 2015 12:51:50 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9EBpqAb43450458 for ; Wed, 14 Oct 2015 11:51:52 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9EBpqxb024373 for ; Wed, 14 Oct 2015 05:51:52 -0600 From: Cornelia Huck Date: Wed, 14 Oct 2015 13:51:43 +0200 Message-Id: <1444823507-7267-6-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> References: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 5/9] s390x: unify device reset during subsystem_reset() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de, David Hildenbrand From: David Hildenbrand We have to manually reset several devices that are not on a bus: Let's collect them in an array. Reviewed-by: Cornelia Huck Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index b9033d4..14b095f 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -35,26 +35,23 @@ typedef struct S390CcwMachineState { bool dea_key_wrap; } S390CcwMachineState; +const char const *reset_dev_types[] = { + "virtual-css-bridge", + "s390-sclp-event-facility", + "s390-flic", + "diag288", +}; + void subsystem_reset(void) { - DeviceState *css, *sclp, *flic, *diag288; + DeviceState *dev; + int i; - css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL)); - if (css) { - qdev_reset_all(css); - } - sclp = DEVICE(object_resolve_path_type("", - "s390-sclp-event-facility", NULL)); - if (sclp) { - qdev_reset_all(sclp); - } - flic = DEVICE(object_resolve_path_type("", "s390-flic", NULL)); - if (flic) { - qdev_reset_all(flic); - } - diag288 = DEVICE(object_resolve_path_type("", "diag288", NULL)); - if (diag288) { - qdev_reset_all(diag288); + for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) { + dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL)); + if (dev) { + qdev_reset_all(dev); + } } } -- 2.6.1