From patchwork Mon Nov 25 15:36:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11260553 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4EFA14C0 for ; Mon, 25 Nov 2019 15:38:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAE8F207FD for ; Mon, 25 Nov 2019 15:38:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="c4ikAQ/Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAE8F207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZGRD-00067V-E2 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Nov 2019 10:38:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZGPr-0004PR-2d for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZGPq-0007pj-35 for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:43 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]:57362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iZGPp-0007pY-Th for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:42 -0500 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAPFWdnQ007388; Mon, 25 Nov 2019 07:36:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=TW99OkJPGvNpk+VsJS+A6yo8TaYTa8Uncc+j5ULJa1Q=; b=c4ikAQ/YcXdAtpjxrqHXotng8vOsh6AhnozXgn6g4CYh1oQeahoT6jFQtRCBPXwX7+6f jo54iJCpeH4wtoByb38ti0BHU+LCuuKIplELnVFjJeFSz3Ot5MdpYRkpavbxwthhuoYN A3MCowg+NPU711g7D3vg0r460DMw8YzN+/ou+oaK9uq5Ild47NTqfK0+xRQQ6CjuhW3J OSo9aGBUaUnzJg6B2rCk1GzoxZaWPSzbq3VRU5QKCaIkXtUqu0mX9NLUVXZ4yrz/lQ8E VgLi27cDDLYbL65EPbJTOuQe5MF18qQJJKcdL0kQmQEgb7dibZxnDcr5c/RhrncF6PpR tg== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2055.outbound.protection.outlook.com [104.47.36.55]) by mx0b-002c1b01.pphosted.com with ESMTP id 2wf36euy2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Nov 2019 07:36:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WlzgF8a+4qt0YQGj91Rz67p5r9b1bzVlCXQhqqHkir4Xa4ZQDr0SMhlMwEFIo+mqvpGL9UCYVzS/pHnVLCsM1kXJYZ0ORv4gs5XVYm+WO+OhymNDJ5SsrLcen9QTSFISQZzEfQzwObV7rfNSGMCfhILWXje7YxnHBFajZ83Xfzhc4b95uoSvp6SPJc7hqxUf1mbd6JJlo5mKpDNkFSo7aKx+xsbonyUgxGtPwYLRe/X4pGgOz9On3dkL6A8jGfmg1jlzAPIWF/55f6fzix+fPRvn81Ua3iXU89FK29INqqDYUVsagamyxr2QeX49dK6hd1BdWqv1yTZHCtGqnQezEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TW99OkJPGvNpk+VsJS+A6yo8TaYTa8Uncc+j5ULJa1Q=; b=SF/mJmsTBucEkJlkqHr2ZwIv/0nqJDu5XFBf6idbjt8bugr8YebpEFW4XM3mc8fkOBkWS0j78SHtHgGz2gN92gJifuWzLoMiWpok2yGf4MdiACtt9hrFKpon7FoqTZNk0DKsnVTn9CSV6zy/elKFdzGfa42ZEuECtmcoD/qYDU83OOe17jthWWnszl8HivaAgYRkMK8qnq9dXC9+V5RrUTJHTCQW7jUzcaA9PIlQemjS333V+2T7F+0cJfNJSFmBBLdYhE6CVrNrZsgBB3SWSJE8fh1xREzSqrMqMtCED5a5ZbLhZF1bLchYTDj/0d22e84+FZiCYE+oL/j/2Jrhzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from MWHPR02MB2656.namprd02.prod.outlook.com (10.168.206.142) by MWHPR02MB3183.namprd02.prod.outlook.com (10.164.133.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Mon, 25 Nov 2019 15:36:40 +0000 Received: from MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::f801:763d:e7fc:6bf]) by MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::f801:763d:e7fc:6bf%7]) with mapi id 15.20.2474.023; Mon, 25 Nov 2019 15:36:40 +0000 From: Felipe Franciosi To: Eduardo Habkost , Markus Armbruster , Stefan Hajnoczi Subject: [PATCH 3/4] ich9: Simplify ich9_lpc_initfn Thread-Topic: [PATCH 3/4] ich9: Simplify ich9_lpc_initfn Thread-Index: AQHVo6YhylH331ZIG06iKIfsf9xAwQ== Date: Mon, 25 Nov 2019 15:36:40 +0000 Message-ID: <20191125153619.39893-4-felipe@nutanix.com> References: <20191125153619.39893-1-felipe@nutanix.com> In-Reply-To: <20191125153619.39893-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR02CA0087.eurprd02.prod.outlook.com (2603:10a6:208:154::28) To MWHPR02MB2656.namprd02.prod.outlook.com (2603:10b6:300:45::14) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [62.254.189.133] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4306dd7d-c457-4b0d-17c3-08d771bd43e6 x-ms-traffictypediagnostic: MWHPR02MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 0232B30BBC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(376002)(396003)(39860400002)(366004)(189003)(199004)(4326008)(6512007)(86362001)(1076003)(3846002)(6116002)(386003)(6506007)(7736002)(305945005)(6436002)(6486002)(478600001)(54906003)(26005)(102836004)(110136005)(2906002)(36756003)(25786009)(14454004)(316002)(446003)(99286004)(256004)(107886003)(66066001)(66446008)(64756008)(66556008)(66476007)(11346002)(2616005)(5660300002)(66946007)(186003)(76176011)(52116002)(50226002)(81166006)(81156014)(8676002)(71200400001)(8936002)(71190400001)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB3183; H:MWHPR02MB2656.namprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nutanix.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SOHuIHJ+d+DmExREUy/Azcn10vMCyVoluGXJlOEOoYR7+rPT98qC+8a7eOEyoqZmR2IM4dVptEg34v/b2LJuQhpgCiAMCudCYW/ddmrEJtUBHJgPl9UJllGHuC0Ps5QpGZCgbjcg/du3iufzb7x84hoxgVoUkypFi9DZ7xuKuYoYMkM9siEHnGaJHqLUVAc2SCIxnfS9guqi5NE5QyooiCiJBozcwHylgYk1D2KkEW3m55BTmkst6OmoaREF8JFlNg8Hpa5MoUemE3VTxvCIwL56fkQzJwiiZ2Wb2Rg3GYpGIE9Aea4d4SLxS27vdq0THJq7ircnAUmz1PelTsc+UQADylrqbgAGkhTlqeFHmbVMZW4DT1AYMMW0MExpq4lKUQMRpokvTsVonKGFFB6fZqslJXkjCtzX62I51rcTl1Y/vE5QElCuN0v/gshz641p MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4306dd7d-c457-4b0d-17c3-08d771bd43e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2019 15:36:40.1203 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jQ9llXtPIn7+Se6k60fGoezL9EC145qwoD+u6qqebaku2EtZRFH6UCcc3mW9494pMMTOV92rXUuswLTJVGsLN8URCxvk8wCF2YQJH00DrWI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3183 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-25_03:2019-11-21,2019-11-25 signatures=0 X-Proofpoint-Spam-Reason: safe X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.155.12 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" , Felipe Franciosi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Currently, ich9_lpc_initfn simply serves as a caller to ich9_lpc_add_properties. This simplifies the code a bit by eliminating ich9_lpc_add_properties altogether and executing its logic in the parent object initialiser function. Signed-off-by: Felipe Franciosi Reviewed-by: Marc-André Lureau --- hw/isa/lpc_ich9.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 240979885d..232c7916f3 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -636,27 +636,22 @@ static void ich9_lpc_get_sci_int(Object *obj, Visitor *v, const char *name, visit_type_uint8(v, name, &value, errp); } -static void ich9_lpc_add_properties(ICH9LPCState *lpc) +static void ich9_lpc_initfn(Object *obj) { + ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj); + static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE; - object_property_add(OBJECT(lpc), ACPI_PM_PROP_SCI_INT, "uint8", + object_property_add(obj, ACPI_PM_PROP_SCI_INT, "uint8", ich9_lpc_get_sci_int, NULL, NULL, NULL, NULL); - object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CMD, + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_ACPI_ENABLE_CMD, &acpi_enable_cmd, true, NULL); - object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_CMD, + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_ACPI_DISABLE_CMD, &acpi_disable_cmd, true, NULL); - ich9_pm_add_properties(OBJECT(lpc), &lpc->pm, NULL); -} - -static void ich9_lpc_initfn(Object *obj) -{ - ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj); - - ich9_lpc_add_properties(lpc); + ich9_pm_add_properties(obj, &lpc->pm, NULL); } static void ich9_lpc_realize(PCIDevice *d, Error **errp)