property.c (1758047057dbe329be712a31b79db7151b5871f8) | property.c (99ece713773bfa17fdb4ee2a1fb3b7bee82e4b1a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ACPI device specific properties support. 4 * 5 * Copyright (C) 2014, Intel Corporation 6 * All rights reserved. 7 * 8 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> --- 673 unchanged lines hidden (view full) --- 682 /* 683 * The simplest case is when the value is a single reference. Just 684 * return that reference then. 685 */ 686 if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { 687 if (index) 688 return -EINVAL; 689 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ACPI device specific properties support. 4 * 5 * Copyright (C) 2014, Intel Corporation 6 * All rights reserved. 7 * 8 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> --- 673 unchanged lines hidden (view full) --- 682 /* 683 * The simplest case is when the value is a single reference. Just 684 * return that reference then. 685 */ 686 if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { 687 if (index) 688 return -EINVAL; 689 |
690 ret = acpi_bus_get_device(obj->reference.handle, &device); 691 if (ret) 692 return ret == -ENODEV ? -EINVAL : ret; | 690 device = acpi_fetch_acpi_dev(obj->reference.handle); 691 if (!device) 692 return -EINVAL; |
693 694 args->fwnode = acpi_fwnode_handle(device); 695 args->nargs = 0; 696 return 0; 697 } 698 699 /* 700 * If it is not a single reference, then it is a package of --- 13 unchanged lines hidden (view full) --- 714 end = element + obj->package.count; 715 716 while (element < end) { 717 u32 nargs, i; 718 719 if (element->type == ACPI_TYPE_LOCAL_REFERENCE) { 720 struct fwnode_handle *ref_fwnode; 721 | 693 694 args->fwnode = acpi_fwnode_handle(device); 695 args->nargs = 0; 696 return 0; 697 } 698 699 /* 700 * If it is not a single reference, then it is a package of --- 13 unchanged lines hidden (view full) --- 714 end = element + obj->package.count; 715 716 while (element < end) { 717 u32 nargs, i; 718 719 if (element->type == ACPI_TYPE_LOCAL_REFERENCE) { 720 struct fwnode_handle *ref_fwnode; 721 |
722 ret = acpi_bus_get_device(element->reference.handle, 723 &device); 724 if (ret) | 722 device = acpi_fetch_acpi_dev(element->reference.handle); 723 if (!device) |
725 return -EINVAL; 726 727 nargs = 0; 728 element++; 729 730 /* 731 * Find the referred data extension node under the 732 * referred device node. --- 346 unchanged lines hidden (view full) --- 1079 1080/** 1081 * acpi_node_get_parent - Return parent fwnode of this fwnode 1082 * @fwnode: Firmware node whose parent to get 1083 * 1084 * Returns parent node of an ACPI device or data firmware node or %NULL if 1085 * not available. 1086 */ | 724 return -EINVAL; 725 726 nargs = 0; 727 element++; 728 729 /* 730 * Find the referred data extension node under the 731 * referred device node. --- 346 unchanged lines hidden (view full) --- 1078 1079/** 1080 * acpi_node_get_parent - Return parent fwnode of this fwnode 1081 * @fwnode: Firmware node whose parent to get 1082 * 1083 * Returns parent node of an ACPI device or data firmware node or %NULL if 1084 * not available. 1085 */ |
1087static struct fwnode_handle * 1088acpi_node_get_parent(const struct fwnode_handle *fwnode) | 1086struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode) |
1089{ 1090 if (is_acpi_data_node(fwnode)) { 1091 /* All data nodes have parent pointer so just return that */ 1092 return to_acpi_data_node(fwnode)->parent; 1093 } else if (is_acpi_device_node(fwnode)) { | 1087{ 1088 if (is_acpi_data_node(fwnode)) { 1089 /* All data nodes have parent pointer so just return that */ 1090 return to_acpi_data_node(fwnode)->parent; 1091 } else if (is_acpi_device_node(fwnode)) { |
1094 struct device *dev = to_acpi_device_node(fwnode)->dev.parent; | 1092 acpi_handle handle, parent_handle; |
1095 | 1093 |
1096 if (dev) 1097 return acpi_fwnode_handle(to_acpi_device(dev)); | 1094 handle = to_acpi_device_node(fwnode)->handle; 1095 if (ACPI_SUCCESS(acpi_get_parent(handle, &parent_handle))) { 1096 struct acpi_device *adev; 1097 1098 if (!acpi_bus_get_device(parent_handle, &adev)) 1099 return acpi_fwnode_handle(adev); 1100 } |
1098 } 1099 1100 return NULL; 1101} 1102 1103/* 1104 * Return true if the node is an ACPI graph node. Called on either ports 1105 * or endpoints. --- 318 unchanged lines hidden --- | 1101 } 1102 1103 return NULL; 1104} 1105 1106/* 1107 * Return true if the node is an ACPI graph node. Called on either ports 1108 * or endpoints. --- 318 unchanged lines hidden --- |