From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4Uca-0004Ww-Mb for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4UcX-0007Hl-W9 for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4UcX-0007Hh-QO for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:29 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 55AE73CB26B for ; Thu, 3 Dec 2015 14:12:29 +0000 (UTC) From: Eduardo Habkost Date: Wed, 2 Dec 2015 20:22:50 -0200 Message-Id: <1449094978-22986-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1449094978-22986-1-git-send-email-ehabkost@redhat.com> References: <1449094978-22986-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 05/13] acpi: Simplify s3/s4 property querying List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , Marcel Apfelbaum , "Michael S. Tsirkin" object_property_get_bool() already returns false when the property is not present, there's no need to call object_property_get_qobject() manually. Signed-off-by: Eduardo Habkost --- hw/i386/acpi-build.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4677e97..9a45a59 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -146,7 +146,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) Object *piix = piix4_pm_find(); Object *lpc = ich9_lpc_find(); Object *obj = NULL; - QObject *o; pm->cpu_hp_io_base = 0; pm->pcihp_io_base = 0; @@ -169,28 +168,15 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->mem_hp_io_base = ACPI_MEMORY_HOTPLUG_BASE; pm->mem_hp_io_len = ACPI_MEMORY_HOTPLUG_IO_LEN; - /* Fill in optional s3/s4 related properties */ - o = object_property_get_qobject(obj, ACPI_PM_PROP_S3_DISABLED, NULL); - if (o) { - pm->s3_disabled = qint_get_int(qobject_to_qint(o)); - } else { - pm->s3_disabled = false; - } - qobject_decref(o); - o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL); - if (o) { - pm->s4_disabled = qint_get_int(qobject_to_qint(o)); - } else { - pm->s4_disabled = false; - } - qobject_decref(o); - o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL); - if (o) { - pm->s4_val = qint_get_int(qobject_to_qint(o)); - } else { - pm->s4_val = false; - } - qobject_decref(o); + /* Fill in optional s3/s4 related properties + * (default to false if property is not present) + */ + pm->s3_disabled = + object_property_get_bool(obj, ACPI_PM_PROP_S3_DISABLED, NULL); + pm->s4_disabled = + object_property_get_bool(obj, ACPI_PM_PROP_S4_DISABLED, NULL); + pm->s4_val = + object_property_get_bool(obj, ACPI_PM_PROP_S4_VAL, NULL); /* Fill in mandatory properties */ pm->sci_int = object_property_get_int(obj, ACPI_PM_PROP_SCI_INT, NULL); -- 2.1.0