ACK: [PATCH] lib: fwts_acpi_object_eval: add fwts_method_test_revision function

Colin Ian King colin.king at canonical.com
Tue Dec 15 09:26:00 UTC 2020


On 10/12/2020 00:27, Alex Hung wrote:
> Fixes: 83c039fcebde ("replace revision checks by fwts_method_test_revision")
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/lib/include/fwts_acpi_object_eval.h |  3 ++-
>  src/lib/src/fwts_acpi_object_eval.c     | 25 +++++++++++++++++++++++++
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
> index a8acec78..0687562f 100644
> --- a/src/lib/include/fwts_acpi_object_eval.h
> +++ b/src/lib/include/fwts_acpi_object_eval.h
> @@ -119,7 +119,8 @@ int fwts_method_buffer_size(fwts_framework *fw, const char *name, ACPI_OBJECT *o
>  int fwts_method_package_count_min(fwts_framework *fw, const char *name, const char *objname, const ACPI_OBJECT *obj, const uint32_t min);
>  int fwts_method_package_count_equal(fwts_framework *fw, const char *name, const char *objname, const ACPI_OBJECT *obj, const uint32_t count);
>  int fwts_method_package_elements_all_type(fwts_framework *fw, const char *name, const char *objname, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
> -int fwts_method_package_elements_type( fwts_framework *fw, const char *name, const char *objname, const ACPI_OBJECT *obj, const fwts_package_element *info, const uint32_t count);
> +int fwts_method_package_elements_type(fwts_framework *fw, const char *name, const char *objname, const ACPI_OBJECT *obj, const fwts_package_element *info, const uint32_t count);
> +int fwts_method_test_revision(fwts_framework *fw, const char *name, const uint32_t cur_revision, const uint32_t spec_revision);
>  
>  void fwts_method_test_integer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
>  void fwts_method_test_string_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
> index 4a9084bc..e8b2e8d5 100644
> --- a/src/lib/src/fwts_acpi_object_eval.c
> +++ b/src/lib/src/fwts_acpi_object_eval.c
> @@ -708,6 +708,31 @@ int fwts_method_package_elements_type(
>  	return failed ? FWTS_ERROR: FWTS_OK;
>  }
>  
> +int fwts_method_test_revision(
> +	fwts_framework *fw,
> +	const char *name,
> +	const uint32_t cur_revision,
> +	const uint32_t spec_revision)
> +{
> +	char method[5];
> +	char tag[22];
> +
> +	if (strlen(name) < 4)
> +		return FWTS_ERROR;
> +
> +	memcpy(method, name + strlen(name) - 4, 4);
> +	method[4] = '\0';
> +	snprintf(tag, 22, "Method%sBadRevision", method);
> +
> +	if (cur_revision != spec_revision) {
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, tag,
> +			"%s revision is not revision %" PRIu32 ".", name, spec_revision);
> +		return FWTS_ERROR;
> +	}
> +
> +	return FWTS_OK;
> +}
> +
>  /*
>   *  fwts_method_test_integer_return
>   *	check if an integer object was returned
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list