From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoYP3-0005J6-Sd for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoYOz-0004fV-7g for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:41 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:48243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoYOy-0004fB-RP for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:37 -0400 Received: from localhost by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Oct 2015 16:00:35 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8D25F2190069 for ; Tue, 20 Oct 2015 16:00:29 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9KF0VXO8520066 for ; Tue, 20 Oct 2015 15:00:31 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9KF0Uqr025372 for ; Tue, 20 Oct 2015 09:00:30 -0600 From: Cornelia Huck Date: Tue, 20 Oct 2015 17:00:21 +0200 Message-Id: <1445353225-16775-6-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1445353225-16775-1-git-send-email-cornelia.huck@de.ibm.com> References: <1445353225-16775-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL 5/9] s390x: unify device reset during subsystem_reset() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, David Hildenbrand , jfrei@linux.vnet.ibm.com, Cornelia Huck 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.2