From patchwork Thu Dec 19 18:02:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11304189 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 52CB56C1 for ; Thu, 19 Dec 2019 18:04:14 +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 24F0C20716 for ; Thu, 19 Dec 2019 18:04:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="ppsK6RUJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24F0C20716 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]:45980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii09k-0006HF-IS for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 Dec 2019 13:04:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39440) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii08H-000467-Ck for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii08F-0002dZ-Uc for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:41 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:41878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii08F-0002Yn-Jq for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:39 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBJHuNb7016852; Thu, 19 Dec 2019 10:02:37 -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=FrN/3cE/GL71upbprZOwMng6lo6UJ/TnJrSz3CAHChQ=; b=ppsK6RUJZ/BzVz64TfuD+6MTCfBQcjVMgAGWYK3B9Wld1B5WClyfVpVY9Dz7skfYT3pC SuCBdLBimxmNHpjgYCuLMbmCDVJysAV2WDetm0LQ0Nz9XVwAk4osAjgctxiSkOY9SRBv HCLGO2lUUUd4hYwje0L8icWKBHQBqupuWpM27spun/O126SQQfK3nKuhoBhaXwuzwRu8 u2JkBq+0MSS8WwisQjL4K8bApxo2evO0c+Q+FAlId4i7nWPeYm+wFjcodhk6jB6yLtrG ZY4FZewF0oY/nFMh4ZwZ54FbKGJ70r8vZQV7AF91WrNBKzcci4HOz0Dbs9rZc2SzpRl6 CQ== Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2057.outbound.protection.outlook.com [104.47.45.57]) by mx0a-002c1b01.pphosted.com with ESMTP id 2wvvy0bn3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Dec 2019 10:02:37 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GyzCJSlxF6uQD8doSLek7Ha7eOAOUcUYP7+0Jtuqql7aNa5YbZOaGyveZDrKUmxQJ5HlhfHyV02vFUOSAmzMbpyrcEddN+GGLbQhF5EDMq63Dj2wFMTsrYX9wzRN/UI4yvWOPDak3cAjO7MUtZxwUXwu4G21cM2dNqxOuLBrp88ZgHOFR/blq3sLnSYfa1CXcvSMoFf0ryraAWGKswFKFZIhJWW30TBfXj4ad1DL8g78VBqVReqQ2lHcVnbKGSvn0MK6Q5GEmMdx4BRCrnqCik3Ocp241JuEPhcw3XXSGvNAaJYFyDwyh5FSnbcQCgCLaRAHpTdQi2KU0MV8g7xpOA== 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=FrN/3cE/GL71upbprZOwMng6lo6UJ/TnJrSz3CAHChQ=; b=nvTAL0yfU08WTlAoxEjZD4cULqc7ZQATo9E8ycuMddGrECNnk8nzLBOPmGrhqiHSrPLRIDfNsbCqEaVJYqSg9nUISohBDwCxL5YH+rxSphHAJ74qmQRrXK6J6sgeIX5gcSud/gtXcqUMPc/4IalO/yL92kNqqUbxuqTBc2afa7Rfh6+ETb3T8RyGBJbIlxUnJoXgKL1HyWvT7puHp/NAURbsmJv31Kow0qZXK4ZPPO0Tyuj1uujgxVpBu24WMAOo6T7mA2VqZBRMjeS71qcN0CL4xXQWSuVrR1snqhjOoCM4iC078o5Wqs86p8BPpjLj8x4sw3B3+Uk58+Mkw4gn5w== 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 MWHPR02MB2303.namprd02.prod.outlook.com (10.168.245.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Thu, 19 Dec 2019 18:02:36 +0000 Received: from MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::c8f8:4820:a24c:3029]) by MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::c8f8:4820:a24c:3029%10]) with mapi id 15.20.2559.012; Thu, 19 Dec 2019 18:02:36 +0000 Received: from nutanix.com (82.9.225.166) by AM4PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:205:1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.4 via Frontend Transport; Thu, 19 Dec 2019 18:02:34 +0000 From: Felipe Franciosi To: Marc-Andre Lureau , Phillipe Mathieu-Daude , Stefan Hajnoczi , Eduardo Habkost , Markus Armbruster , Alexey Kardashevskiy Subject: [PATCH v4 3/4] ich9: Simplify ich9_lpc_initfn Thread-Topic: [PATCH v4 3/4] ich9: Simplify ich9_lpc_initfn Thread-Index: AQHVtpZ+XRpRLxgYrk+jiKZGoI3x4Q== Date: Thu, 19 Dec 2019 18:02:36 +0000 Message-ID: <20191219180205.25191-4-felipe@nutanix.com> References: <20191219180205.25191-1-felipe@nutanix.com> In-Reply-To: <20191219180205.25191-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM4PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:205:1::17) 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: [82.9.225.166] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ddb5fec0-fdf6-49f1-07e4-08d784ada107 x-ms-traffictypediagnostic: MWHPR02MB2303: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 0256C18696 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(376002)(346002)(39860400002)(136003)(366004)(189003)(199004)(66476007)(5660300002)(16526019)(186003)(66446008)(26005)(956004)(2906002)(4326008)(36756003)(8886007)(52116002)(1076003)(7696005)(81166006)(8936002)(81156014)(86362001)(8676002)(478600001)(66946007)(2616005)(64756008)(55016002)(107886003)(71200400001)(110136005)(66556008)(54906003)(316002)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB2303; 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: gId7gTAWPBqM2CFI5z8IG7e0/W3jyvCNKaRzbNEd1k8rsgSGkBPvvorj9s/vRsvwqJVovRHNRHHZkWW2PpGb54+U/0c6WwCNCttizKL+eWxbwtAwoc9c2GxxvxO8M1dBms1osAsMwqNdQsfTyvytW+y3sYtk4770gSaGKOcJU0a+5sLjQpCF9PDd7q91eeQCQ9tyPnGUiy/5/GCXi0/zm1vRugogZpBNja+WaLbR+gdhDVJVnPFWe6GG7uzyLFDuGy6Pn24rowZ9+bFcTuNSnIZR2r3bJOgmZQjt/iFT/baP9K6yCmz6MEpv5k9PWnWjZ54jhl6yj/VOR2FInsIceoexG8IWuzCbv1dGzisAUF+59tOikP4P+7R8lc+Bdzgvo0672MlQjOWCfbgMFyGqDTVZzMUSZNSWN5PMD1N0gLYcLrGV2WdfPpyOa6sbX8+iLMKF1TFDPaijY8S4/nAP4SsdU1+5+D1Q95zppEZzlZn1uLdbie5dk7fpK80PiVzB MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddb5fec0-fdf6-49f1-07e4-08d784ada107 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2019 18:02:36.5534 (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: dB9L9uPdHj6DJWGI+w0eoHFmkYHdHRhJGSolCIOp/1YsvzLLgad7DVwPv/7Wg+7spXcAECkqvvkAbMCcZl+zVXxTntuAMhlsxGFTzYaMeDk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2303 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-19_06:2019-12-17,2019-12-19 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.151.68 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: Philippe Mathieu-Daudé --- hw/isa/lpc_ich9.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 9f4e00dddd..c40bb3c420 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -634,12 +634,14 @@ static void ich9_lpc_get_sci_int(Object *obj, Visitor *v, const char *name, visit_type_uint8(v, name, &lpc->sci_gsi, 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, @@ -647,14 +649,7 @@ static void ich9_lpc_add_properties(ICH9LPCState *lpc) object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_CMD, &acpi_disable_cmd, OBJ_PROP_FLAG_READ, 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)