diff mbox

[1/3] acpi: method: skip scope names in method_evaluate_method

Message ID 1442309133-362-2-git-send-email-alex.hung@canonical.com
State Accepted
Headers show

Commit Message

Alex Hung Sept. 15, 2015, 9:25 a.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/method/method.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Colin Ian King Sept. 15, 2015, 11:01 a.m. UTC | #1
On 15/09/15 10:25, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 767b7ac..b3df7e5 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -501,15 +501,32 @@ static int method_evaluate_method(fwts_framework *fw,
>  	size_t name_len = strlen(name);
>  	bool found = false;
>  
> +
>  	if ((methods = fwts_acpi_object_get_names()) != NULL) {
>  		fwts_list_link	*item;
>  
>  		fwts_list_foreach(item, methods) {
>  			char *method_name = fwts_list_data(char*, item);
> +			ACPI_HANDLE method_handle;
> +			ACPI_OBJECT_TYPE type;
> +			ACPI_STATUS status;
> +
>  			size_t len = strlen(method_name);
>  			if (strncmp(name, method_name + len - name_len, name_len) == 0) {
>  				ACPI_OBJECT_LIST  arg_list;
>  
> +				status = AcpiGetHandle (NULL, method_name, &method_handle);
> +				if (ACPI_FAILURE(status)) {
> +					fwts_warning(fw, "Failed to get handle for object %s.", name);
> +				}
> +				status = AcpiGetType(method_handle, &type);
> +				if (ACPI_FAILURE(status)) {
> +					fwts_warning(fw, "Failed to get object type for %s.",name);
> +				}
> +
> +				if (type == ACPI_TYPE_LOCAL_SCOPE)
> +					continue;
> +
>  				found = true;
>  				arg_list.Count   = num_args;
>  				arg_list.Pointer = args;
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu Sept. 21, 2015, 6:56 a.m. UTC | #2
On 2015年09月15日 17:25, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>   src/acpi/method/method.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 767b7ac..b3df7e5 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -501,15 +501,32 @@ static int method_evaluate_method(fwts_framework *fw,
>   	size_t name_len = strlen(name);
>   	bool found = false;
>   
> +
>   	if ((methods = fwts_acpi_object_get_names()) != NULL) {
>   		fwts_list_link	*item;
>   
>   		fwts_list_foreach(item, methods) {
>   			char *method_name = fwts_list_data(char*, item);
> +			ACPI_HANDLE method_handle;
> +			ACPI_OBJECT_TYPE type;
> +			ACPI_STATUS status;
> +
>   			size_t len = strlen(method_name);
>   			if (strncmp(name, method_name + len - name_len, name_len) == 0) {
>   				ACPI_OBJECT_LIST  arg_list;
>   
> +				status = AcpiGetHandle (NULL, method_name, &method_handle);
> +				if (ACPI_FAILURE(status)) {
> +					fwts_warning(fw, "Failed to get handle for object %s.", name);
> +				}
> +				status = AcpiGetType(method_handle, &type);
> +				if (ACPI_FAILURE(status)) {
> +					fwts_warning(fw, "Failed to get object type for %s.",name);
> +				}
> +
> +				if (type == ACPI_TYPE_LOCAL_SCOPE)
> +					continue;
> +
>   				found = true;
>   				arg_list.Count   = num_args;
>   				arg_list.Pointer = args;
Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 767b7ac..b3df7e5 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -501,15 +501,32 @@  static int method_evaluate_method(fwts_framework *fw,
 	size_t name_len = strlen(name);
 	bool found = false;
 
+
 	if ((methods = fwts_acpi_object_get_names()) != NULL) {
 		fwts_list_link	*item;
 
 		fwts_list_foreach(item, methods) {
 			char *method_name = fwts_list_data(char*, item);
+			ACPI_HANDLE method_handle;
+			ACPI_OBJECT_TYPE type;
+			ACPI_STATUS status;
+
 			size_t len = strlen(method_name);
 			if (strncmp(name, method_name + len - name_len, name_len) == 0) {
 				ACPI_OBJECT_LIST  arg_list;
 
+				status = AcpiGetHandle (NULL, method_name, &method_handle);
+				if (ACPI_FAILURE(status)) {
+					fwts_warning(fw, "Failed to get handle for object %s.", name);
+				}
+				status = AcpiGetType(method_handle, &type);
+				if (ACPI_FAILURE(status)) {
+					fwts_warning(fw, "Failed to get object type for %s.",name);
+				}
+
+				if (type == ACPI_TYPE_LOCAL_SCOPE)
+					continue;
+
 				found = true;
 				arg_list.Count   = num_args;
 				arg_list.Pointer = args;