From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zoqez-0001bz-Ev for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:30:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zoqev-00081m-C5 for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:30:21 -0400 Received: from e06smtp05.uk.ibm.com ([195.75.94.101]:46499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zoqev-00080D-3v for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:30:17 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Oct 2015 11:30:15 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id BA69317D805A for ; Wed, 21 Oct 2015 11:30:22 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9LAUD8t33816624 for ; Wed, 21 Oct 2015 10:30:13 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 t9LAUDwS008772 for ; Wed, 21 Oct 2015 04:30:13 -0600 From: Cornelia Huck Date: Wed, 21 Oct 2015 12:30:05 +0200 Message-Id: <1445423409-22218-6-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1445423409-22218-1-git-send-email-cornelia.huck@de.ibm.com> References: <1445423409-22218-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL v2 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..5e56fbf 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; +static 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