From patchwork Thu Aug 3 06:27:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9878179 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 947F5603F4 for ; Thu, 3 Aug 2017 06:27:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8662228877 for ; Thu, 3 Aug 2017 06:27:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B03F2887A; Thu, 3 Aug 2017 06:27:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28C7728884 for ; Thu, 3 Aug 2017 06:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978AbdHCG1N (ORCPT ); Thu, 3 Aug 2017 02:27:13 -0400 Received: from mga02.intel.com ([134.134.136.20]:30275 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbdHCG1M (ORCPT ); Thu, 3 Aug 2017 02:27:12 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2017 23:27:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,314,1498546800"; d="scan'208";a="135453243" Received: from unknown (HELO lvzheng-MOBLsp3.sh.intel.com) ([10.239.159.74]) by fmsmga006.fm.intel.com with ESMTP; 02 Aug 2017 23:27:10 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Robert Moore , Len Brown , Lv Zheng , "David E . Box" Cc: Lv Zheng , linux-acpi@vger.kernel.org Subject: [PATCH 09/15] ACPICA: Interpreter: Update handling for Alias operator Date: Thu, 3 Aug 2017 14:27:09 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Moore ACPICA commit 719d0bdd48e3e8e7a62a86c04922b9f41da6def0 Provide common creation code for the Alias operator. All objects are now handled the same, with the only exception being the Method() operator. It has a special internal Alias type. Link: https://github.com/acpica/acpica/commit/719d0bdd Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/excreate.c | 61 ++++++++++-------------------------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 6867586..b8adb11 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c @@ -88,72 +88,39 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) } /* Ensure that the target node is valid */ + if (!target_node) { return_ACPI_STATUS(AE_NULL_OBJECT); } - /* - * For objects that can never change (i.e., the NS node will - * permanently point to the same object), we can simply attach - * the object to the new NS node. For other objects (such as - * Integers, buffers, etc.), we have to point the Alias node - * to the original Node. - */ - switch (target_node->type) { - - /* For these types, the sub-object can change dynamically via a Store */ - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_PACKAGE: - case ACPI_TYPE_BUFFER_FIELD: - /* - * These types open a new scope, so we need the NS node in order to access - * any children. - */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_LOCAL_SCOPE: - /* - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. - */ - alias_node->type = ACPI_TYPE_LOCAL_ALIAS; - alias_node->object = - ACPI_CAST_PTR(union acpi_operand_object, target_node); - break; + /* Construct the alias object (a namespace node) */ + switch (target_node->type) { case ACPI_TYPE_METHOD: /* - * Control method aliases need to be differentiated + * Control method aliases need to be differentiated with + * a special type */ alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; - alias_node->object = - ACPI_CAST_PTR(union acpi_operand_object, target_node); break; default: - - /* Attach the original source object to the new Alias Node */ - /* - * The new alias assumes the type of the target, and it points - * to the same object. The reference count of the object has an - * additional reference to prevent deletion out from under either the - * target node or the alias Node + * All other object types. + * + * The new alias has the type ALIAS and points to the original + * NS node, not the object itself. */ - status = acpi_ns_attach_object(alias_node, - acpi_ns_get_attached_object - (target_node), - target_node->type); + alias_node->type = ACPI_TYPE_LOCAL_ALIAS; + alias_node->object = + ACPI_CAST_PTR(union acpi_operand_object, target_node); break; } /* Since both operands are Nodes, we don't need to delete them */ + alias_node->object = + ACPI_CAST_PTR(union acpi_operand_object, target_node); return_ACPI_STATUS(status); }