diff mbox series

method: replace duplicated code by util function in _PRR test

Message ID 20200515213616.1086689-1-alex.hung@canonical.com
State Accepted
Headers show
Series method: replace duplicated code by util function in _PRR test | expand

Commit Message

Alex Hung May 15, 2020, 9:36 p.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/method/method.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Colin Ian King May 15, 2020, 9:38 p.m. UTC | #1
On 15/05/2020 22:36, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index b7e9177c..11e230ea 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -1609,13 +1609,8 @@ static void method_test_PRR_return(
>  	if (fwts_method_package_count_equal(fw, name, "_PRR", obj, 1) != FWTS_OK)
>  		return;
>  
> -	if (obj->Package.Elements[0].Type != ACPI_TYPE_LOCAL_REFERENCE) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -			"Method_PRRElementType",
> -			"%s returned a package that does not contain "
> -			"a reference.", name);
> +	if (fwts_method_package_elements_all_type(fw, name, "_PRR", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
>  		return;
> -	}
>  
>  	fwts_method_passed_sane(fw, name, "package");
>  }
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu May 22, 2020, 3:18 a.m. UTC | #2
On 5/16/20 5:36 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/method/method.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index b7e9177c..11e230ea 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -1609,13 +1609,8 @@ static void method_test_PRR_return(
>  	if (fwts_method_package_count_equal(fw, name, "_PRR", obj, 1) != FWTS_OK)
>  		return;
>  
> -	if (obj->Package.Elements[0].Type != ACPI_TYPE_LOCAL_REFERENCE) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -			"Method_PRRElementType",
> -			"%s returned a package that does not contain "
> -			"a reference.", name);
> +	if (fwts_method_package_elements_all_type(fw, name, "_PRR", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
>  		return;
> -	}
>  
>  	fwts_method_passed_sane(fw, name, "package");
>  }
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index b7e9177c..11e230ea 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -1609,13 +1609,8 @@  static void method_test_PRR_return(
 	if (fwts_method_package_count_equal(fw, name, "_PRR", obj, 1) != FWTS_OK)
 		return;
 
-	if (obj->Package.Elements[0].Type != ACPI_TYPE_LOCAL_REFERENCE) {
-		fwts_failed(fw, LOG_LEVEL_MEDIUM,
-			"Method_PRRElementType",
-			"%s returned a package that does not contain "
-			"a reference.", name);
+	if (fwts_method_package_elements_all_type(fw, name, "_PRR", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
 		return;
-	}
 
 	fwts_method_passed_sane(fw, name, "package");
 }