diff mbox series

fwts_acpi_object_eval.h: constify read-only function arguments

Message ID 20210410230949.1125552-1-colin.king@canonical.com
State Accepted
Headers show
Series fwts_acpi_object_eval.h: constify read-only function arguments | expand

Commit Message

Colin Ian King April 10, 2021, 11:09 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Make read-only function arguments const. Also re-format prototypes in
header file fit into 80 columns.  Clean up some macro indentations.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_acpi_object_eval.h | 181 ++++++++++++++++--------
 src/lib/src/fwts_acpi_object_eval.c     |  33 +++--
 2 files changed, 140 insertions(+), 74 deletions(-)

Comments

Alex Hung April 11, 2021, 8:52 p.m. UTC | #1
On 2021-04-10 5:09 p.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make read-only function arguments const. Also re-format prototypes in
> header file fit into 80 columns.  Clean up some macro indentations.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts_acpi_object_eval.h | 181 ++++++++++++++++--------
>  src/lib/src/fwts_acpi_object_eval.c     |  33 +++--
>  2 files changed, 140 insertions(+), 74 deletions(-)
> 
> diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
> index 32c8f6bf..b818146e 100644
> --- a/src/lib/include/fwts_acpi_object_eval.h
> +++ b/src/lib/include/fwts_acpi_object_eval.h
> @@ -32,12 +32,14 @@ int fwts_acpi_deinit(fwts_framework *fw);
>  char *fwts_acpi_object_exists(const char *name);
>  fwts_list *fwts_acpi_object_get_names(void);
>  void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj);
> -void fwts_acpi_object_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
> -ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
> +void fwts_acpi_object_evaluate_report_error(fwts_framework *fw,
> +	const char *name, const ACPI_STATUS status);
> +ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name,
> +	ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
>  
>  /* Test types */
>  #define METHOD_MANDATORY	1
> -#define METHOD_OPTIONAL	2
> +#define METHOD_OPTIONAL		2
>  #define METHOD_MOBILE		4
>  #define METHOD_SILENT		8
>  
> @@ -112,43 +114,83 @@ typedef struct {
>  #define fwts_method_package_elements_type(fw, name, obj, info)	\
>  	fwts_method_package_elements_type__(fw, name, obj, info, FWTS_ARRAY_SIZE(info))
>  
> -int fwts_method_check_type__(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT_TYPE type, char *type_name);
> -int fwts_method_check_element_type(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, uint32_t subpkg, uint32_t element, ACPI_OBJECT_TYPE type);
> +int fwts_method_check_type__(fwts_framework *fw, const char *name,
> +	const ACPI_BUFFER *buf, const ACPI_OBJECT_TYPE type,
> +	const char *type_name);
> +int fwts_method_check_element_type(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t subpkg,
> +	const uint32_t element, const ACPI_OBJECT_TYPE type);
>  const char *fwts_method_type_name(const ACPI_OBJECT_TYPE type);
> -void fwts_method_passed_sane(fwts_framework *fw, const char *name, const char *type);
> -void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name, const uint64_t value);
> -void fwts_method_failed_null_object(fwts_framework *fw, const char *name, const char *type);
> -bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2);
> -int fwts_method_buffer_size(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, size_t buf_size);
> -int fwts_method_package_count_min(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t min);
> -int fwts_method_package_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t count);
> -int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
> -int fwts_method_package_elements_all_type(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
> -int fwts_method_package_elements_type__(fwts_framework *fw, const char *name, 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);
> -void fwts_method_test_reference_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NULL_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_buffer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
> -void fwts_method_test_all_reference_package_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_integer_max_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_package_integer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_passed_failed_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_polling_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void method_evaluate_found_method(fwts_framework *fw, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
> -void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
> -int fwts_evaluate_method(fwts_framework *fw, uint32_t test_type, ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args, uint32_t num_args, fwts_method_return check_func, void *private);
> -
> -bool fwts_method_valid_HID_string(char *str);
> -bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len);
> -
> -void fwts_method_test_CRS_large_size( fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t crs_length, const size_t min, const size_t max, bool *passed);
> -void fwts_method_test_CRS_large_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const uint64_t length, bool *passed, const char **tag);
> -void fwts_method_test_CRS_small_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t length, bool *passed, const char **tag) ;
> +void fwts_method_passed_sane(fwts_framework *fw, const char *name,
> +	const char *type);
> +void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name,
> +	const uint64_t value);
> +void fwts_method_failed_null_object(fwts_framework *fw, const char *name,
> +	const char *type);
> +bool fwts_method_type_matches(const ACPI_OBJECT_TYPE t1,
> +	const ACPI_OBJECT_TYPE t2);
> +int fwts_method_buffer_size(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const size_t buf_size);
> +int fwts_method_package_count_min(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t min);
> +int fwts_method_package_count_equal(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t count);
> +int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
> +int fwts_method_package_elements_all_type(fwts_framework *fw,
> +	const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
> +int fwts_method_package_elements_type__(fwts_framework *fw, const char *name,
> +	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);
> +void fwts_method_test_reference_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NULL_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_buffer_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
> +void fwts_method_test_all_reference_package_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_integer_max_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_package_integer_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_passed_failed_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_polling_return( fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void method_evaluate_found_method(fwts_framework *fw,
> +	char *name, fwts_method_return check_func, void *private,
> +	ACPI_OBJECT_LIST *arg_list);
> +void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent,
> +	char *name, fwts_method_return check_func, void *private,
> +	ACPI_OBJECT_LIST *arg_list);
> +int fwts_evaluate_method(fwts_framework *fw, const uint32_t test_type,
> +	ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args,
> +	uint32_t num_args, fwts_method_return check_func, void *private);
> +
> +bool fwts_method_valid_HID_string(const char *str);
> +bool fwts_method_valid_EISA_ID(const uint32_t id, char *buf,
> +	const size_t buf_len);
> +
> +void fwts_method_test_CRS_large_size(fwts_framework *fw, const char *name,
> +	const char *objname, const uint8_t *data, const size_t crs_length,
> +	const size_t min, const size_t max, bool *passed);
> +void fwts_method_test_CRS_large_resource_items(fwts_framework *fw,
> +	const char *name, const char *objname, const uint8_t *data,
> +	const uint64_t length, bool *passed, const char **tag);
> +void fwts_method_test_CRS_small_resource_items(fwts_framework *fw,
> +	const char *name, const char *objname, const uint8_t *data,
> +	const size_t length, bool *passed, const char **tag) ;
>  
>  /* Device Identification Objects - see Section 6 Device Configuration */
>  int fwts_method_test_ADR(fwts_framework *fw, ACPI_HANDLE *device);
> @@ -164,26 +206,45 @@ int fwts_method_test_SUN(fwts_framework *fw, ACPI_HANDLE *device);
>  int fwts_method_test_STR(fwts_framework *fw, ACPI_HANDLE *device);
>  int fwts_method_test_UID(fwts_framework *fw, ACPI_HANDLE *device);
>  
> -void fwts_method_test_BMD_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BPC_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BPS_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_valid_CID_Type(fwts_framework *fw, char *name, ACPI_OBJECT *obj);
> -void fwts_method_test_CID_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_HID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_MLS_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_PLD_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_SUB_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_UID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void fwts_method_test_NBS_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NCH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIC_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIG_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void fwts_method_test_STA_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BIF_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BIX_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BST_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BMD_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BPC_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BPS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_valid_CID_Type(fwts_framework *fw, char *name,
> +	ACPI_OBJECT *obj);
> +void fwts_method_test_CID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_HID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_MLS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_PLD_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_SUB_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_UID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void fwts_method_test_NBS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NCH_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIC_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIH_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIG_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void fwts_method_test_STA_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BIF_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BIX_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BST_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
>  
>  #endif
> diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
> index 020ff3c5..36b92734 100644
> --- a/src/lib/src/fwts_acpi_object_eval.c
> +++ b/src/lib/src/fwts_acpi_object_eval.c
> @@ -474,10 +474,10 @@ ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
>  
>  int fwts_method_check_type__(
>  	fwts_framework *fw,
> -	char *name,
> -	ACPI_BUFFER *buf,
> -	ACPI_OBJECT_TYPE type,
> -	char *type_name)
> +	const char *name,
> +	const ACPI_BUFFER *buf,
> +	const ACPI_OBJECT_TYPE type,
> +	const char *type_name)
>  {
>  	ACPI_OBJECT *obj;
>  
> @@ -548,10 +548,10 @@ static const char *acpi_object_names[] = {
>  int fwts_method_check_element_type(
>  	fwts_framework *fw,
>  	const char *name,
> -	ACPI_OBJECT *obj,
> -	uint32_t subpkg,
> -	uint32_t element,
> -	ACPI_OBJECT_TYPE type)
> +	const ACPI_OBJECT *obj,
> +	const uint32_t subpkg,
> +	const uint32_t element,
> +	const ACPI_OBJECT_TYPE type)
>  {
>  	if (obj->Package.Elements[element].Type != type) {
>  		char obj_name[5] = "_XYZ";
> @@ -642,7 +642,9 @@ void fwts_method_failed_null_object(
>  		"return %s.", name, type);
>  }
>  
> -bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
> +bool fwts_method_type_matches(
> +	const ACPI_OBJECT_TYPE t1,
> +	const ACPI_OBJECT_TYPE t2)
>  {
>  	if (t1 == ACPI_TYPE_INTBUF &&
>  	    (t2 == ACPI_TYPE_INTEGER || t2 == ACPI_TYPE_BUFFER))
> @@ -662,8 +664,8 @@ bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
>  int fwts_method_buffer_size(
>  	fwts_framework *fw,
>  	const char *name,
> -	ACPI_OBJECT *obj,
> -	size_t buf_size)
> +	const ACPI_OBJECT *obj,
> +	const size_t buf_size)
>  {
>  	if (obj->Buffer.Length != buf_size) {
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
> @@ -1176,7 +1178,7 @@ void fwts_evaluate_found_method(
>  }
>  
>  int fwts_evaluate_method(fwts_framework *fw,
> -	uint32_t test_type,  /* Manditory or optional */
> +	const uint32_t test_type,  /* Manditory or optional */
>  	ACPI_HANDLE *parent,
>  	char *name,
>  	ACPI_OBJECT *args,
> @@ -1210,7 +1212,7 @@ int fwts_evaluate_method(fwts_framework *fw,
>  	return FWTS_OK;
>  }
>  
> -bool fwts_method_valid_HID_string(char *str)
> +bool fwts_method_valid_HID_string(const char *str)
>  {
>  	if (strlen(str) == 7) {
>  		/* PNP ID, must be 3 capitals followed by 4 hex */
> @@ -1240,7 +1242,10 @@ bool fwts_method_valid_HID_string(char *str)
>  	return false;
>  }
>  
> -bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len)
> +bool fwts_method_valid_EISA_ID(
> +	const uint32_t id,
> +	char *buf,
> +	const size_t buf_len)
>  {
>  	snprintf(buf, buf_len, "%c%c%c%02" PRIX32 "%02" PRIX32,
>  		0x40 + ((id >> 2) & 0x1f),
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu April 12, 2021, 7:21 a.m. UTC | #2
On 4/11/21 7:09 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make read-only function arguments const. Also re-format prototypes in
> header file fit into 80 columns.  Clean up some macro indentations.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts_acpi_object_eval.h | 181 ++++++++++++++++--------
>  src/lib/src/fwts_acpi_object_eval.c     |  33 +++--
>  2 files changed, 140 insertions(+), 74 deletions(-)
> 
> diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
> index 32c8f6bf..b818146e 100644
> --- a/src/lib/include/fwts_acpi_object_eval.h
> +++ b/src/lib/include/fwts_acpi_object_eval.h
> @@ -32,12 +32,14 @@ int fwts_acpi_deinit(fwts_framework *fw);
>  char *fwts_acpi_object_exists(const char *name);
>  fwts_list *fwts_acpi_object_get_names(void);
>  void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj);
> -void fwts_acpi_object_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
> -ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
> +void fwts_acpi_object_evaluate_report_error(fwts_framework *fw,
> +	const char *name, const ACPI_STATUS status);
> +ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name,
> +	ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
>  
>  /* Test types */
>  #define METHOD_MANDATORY	1
> -#define METHOD_OPTIONAL	2
> +#define METHOD_OPTIONAL		2
>  #define METHOD_MOBILE		4
>  #define METHOD_SILENT		8
>  
> @@ -112,43 +114,83 @@ typedef struct {
>  #define fwts_method_package_elements_type(fw, name, obj, info)	\
>  	fwts_method_package_elements_type__(fw, name, obj, info, FWTS_ARRAY_SIZE(info))
>  
> -int fwts_method_check_type__(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT_TYPE type, char *type_name);
> -int fwts_method_check_element_type(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, uint32_t subpkg, uint32_t element, ACPI_OBJECT_TYPE type);
> +int fwts_method_check_type__(fwts_framework *fw, const char *name,
> +	const ACPI_BUFFER *buf, const ACPI_OBJECT_TYPE type,
> +	const char *type_name);
> +int fwts_method_check_element_type(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t subpkg,
> +	const uint32_t element, const ACPI_OBJECT_TYPE type);
>  const char *fwts_method_type_name(const ACPI_OBJECT_TYPE type);
> -void fwts_method_passed_sane(fwts_framework *fw, const char *name, const char *type);
> -void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name, const uint64_t value);
> -void fwts_method_failed_null_object(fwts_framework *fw, const char *name, const char *type);
> -bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2);
> -int fwts_method_buffer_size(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, size_t buf_size);
> -int fwts_method_package_count_min(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t min);
> -int fwts_method_package_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t count);
> -int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
> -int fwts_method_package_elements_all_type(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
> -int fwts_method_package_elements_type__(fwts_framework *fw, const char *name, 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);
> -void fwts_method_test_reference_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NULL_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_buffer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
> -void fwts_method_test_all_reference_package_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_integer_max_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_package_integer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_passed_failed_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_polling_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void method_evaluate_found_method(fwts_framework *fw, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
> -void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
> -int fwts_evaluate_method(fwts_framework *fw, uint32_t test_type, ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args, uint32_t num_args, fwts_method_return check_func, void *private);
> -
> -bool fwts_method_valid_HID_string(char *str);
> -bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len);
> -
> -void fwts_method_test_CRS_large_size( fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t crs_length, const size_t min, const size_t max, bool *passed);
> -void fwts_method_test_CRS_large_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const uint64_t length, bool *passed, const char **tag);
> -void fwts_method_test_CRS_small_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t length, bool *passed, const char **tag) ;
> +void fwts_method_passed_sane(fwts_framework *fw, const char *name,
> +	const char *type);
> +void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name,
> +	const uint64_t value);
> +void fwts_method_failed_null_object(fwts_framework *fw, const char *name,
> +	const char *type);
> +bool fwts_method_type_matches(const ACPI_OBJECT_TYPE t1,
> +	const ACPI_OBJECT_TYPE t2);
> +int fwts_method_buffer_size(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const size_t buf_size);
> +int fwts_method_package_count_min(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t min);
> +int fwts_method_package_count_equal(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t count);
> +int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name,
> +	const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
> +int fwts_method_package_elements_all_type(fwts_framework *fw,
> +	const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
> +int fwts_method_package_elements_type__(fwts_framework *fw, const char *name,
> +	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);
> +void fwts_method_test_reference_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NULL_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_buffer_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
> +void fwts_method_test_all_reference_package_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_integer_max_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_package_integer_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_passed_failed_return(fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_polling_return( fwts_framework *fw,
> +	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void method_evaluate_found_method(fwts_framework *fw,
> +	char *name, fwts_method_return check_func, void *private,
> +	ACPI_OBJECT_LIST *arg_list);
> +void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent,
> +	char *name, fwts_method_return check_func, void *private,
> +	ACPI_OBJECT_LIST *arg_list);
> +int fwts_evaluate_method(fwts_framework *fw, const uint32_t test_type,
> +	ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args,
> +	uint32_t num_args, fwts_method_return check_func, void *private);
> +
> +bool fwts_method_valid_HID_string(const char *str);
> +bool fwts_method_valid_EISA_ID(const uint32_t id, char *buf,
> +	const size_t buf_len);
> +
> +void fwts_method_test_CRS_large_size(fwts_framework *fw, const char *name,
> +	const char *objname, const uint8_t *data, const size_t crs_length,
> +	const size_t min, const size_t max, bool *passed);
> +void fwts_method_test_CRS_large_resource_items(fwts_framework *fw,
> +	const char *name, const char *objname, const uint8_t *data,
> +	const uint64_t length, bool *passed, const char **tag);
> +void fwts_method_test_CRS_small_resource_items(fwts_framework *fw,
> +	const char *name, const char *objname, const uint8_t *data,
> +	const size_t length, bool *passed, const char **tag) ;
>  
>  /* Device Identification Objects - see Section 6 Device Configuration */
>  int fwts_method_test_ADR(fwts_framework *fw, ACPI_HANDLE *device);
> @@ -164,26 +206,45 @@ int fwts_method_test_SUN(fwts_framework *fw, ACPI_HANDLE *device);
>  int fwts_method_test_STR(fwts_framework *fw, ACPI_HANDLE *device);
>  int fwts_method_test_UID(fwts_framework *fw, ACPI_HANDLE *device);
>  
> -void fwts_method_test_BMD_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BPC_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BPS_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_valid_CID_Type(fwts_framework *fw, char *name, ACPI_OBJECT *obj);
> -void fwts_method_test_CID_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_HID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_MLS_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_PLD_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_SUB_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_UID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void fwts_method_test_NBS_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NCH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIC_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_NIG_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -
> -void fwts_method_test_STA_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BIF_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BIX_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> -void fwts_method_test_BST_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BMD_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BPC_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BPS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_valid_CID_Type(fwts_framework *fw, char *name,
> +	ACPI_OBJECT *obj);
> +void fwts_method_test_CID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_HID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_MLS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_PLD_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_SUB_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_UID_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void fwts_method_test_NBS_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NCH_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIC_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIH_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_NIG_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +
> +void fwts_method_test_STA_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BIF_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BIX_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
> +void fwts_method_test_BST_return(fwts_framework *fw, char *name,
> +	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
>  
>  #endif
> diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
> index 020ff3c5..36b92734 100644
> --- a/src/lib/src/fwts_acpi_object_eval.c
> +++ b/src/lib/src/fwts_acpi_object_eval.c
> @@ -474,10 +474,10 @@ ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
>  
>  int fwts_method_check_type__(
>  	fwts_framework *fw,
> -	char *name,
> -	ACPI_BUFFER *buf,
> -	ACPI_OBJECT_TYPE type,
> -	char *type_name)
> +	const char *name,
> +	const ACPI_BUFFER *buf,
> +	const ACPI_OBJECT_TYPE type,
> +	const char *type_name)
>  {
>  	ACPI_OBJECT *obj;
>  
> @@ -548,10 +548,10 @@ static const char *acpi_object_names[] = {
>  int fwts_method_check_element_type(
>  	fwts_framework *fw,
>  	const char *name,
> -	ACPI_OBJECT *obj,
> -	uint32_t subpkg,
> -	uint32_t element,
> -	ACPI_OBJECT_TYPE type)
> +	const ACPI_OBJECT *obj,
> +	const uint32_t subpkg,
> +	const uint32_t element,
> +	const ACPI_OBJECT_TYPE type)
>  {
>  	if (obj->Package.Elements[element].Type != type) {
>  		char obj_name[5] = "_XYZ";
> @@ -642,7 +642,9 @@ void fwts_method_failed_null_object(
>  		"return %s.", name, type);
>  }
>  
> -bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
> +bool fwts_method_type_matches(
> +	const ACPI_OBJECT_TYPE t1,
> +	const ACPI_OBJECT_TYPE t2)
>  {
>  	if (t1 == ACPI_TYPE_INTBUF &&
>  	    (t2 == ACPI_TYPE_INTEGER || t2 == ACPI_TYPE_BUFFER))
> @@ -662,8 +664,8 @@ bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
>  int fwts_method_buffer_size(
>  	fwts_framework *fw,
>  	const char *name,
> -	ACPI_OBJECT *obj,
> -	size_t buf_size)
> +	const ACPI_OBJECT *obj,
> +	const size_t buf_size)
>  {
>  	if (obj->Buffer.Length != buf_size) {
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
> @@ -1176,7 +1178,7 @@ void fwts_evaluate_found_method(
>  }
>  
>  int fwts_evaluate_method(fwts_framework *fw,
> -	uint32_t test_type,  /* Manditory or optional */
> +	const uint32_t test_type,  /* Manditory or optional */
>  	ACPI_HANDLE *parent,
>  	char *name,
>  	ACPI_OBJECT *args,
> @@ -1210,7 +1212,7 @@ int fwts_evaluate_method(fwts_framework *fw,
>  	return FWTS_OK;
>  }
>  
> -bool fwts_method_valid_HID_string(char *str)
> +bool fwts_method_valid_HID_string(const char *str)
>  {
>  	if (strlen(str) == 7) {
>  		/* PNP ID, must be 3 capitals followed by 4 hex */
> @@ -1240,7 +1242,10 @@ bool fwts_method_valid_HID_string(char *str)
>  	return false;
>  }
>  
> -bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len)
> +bool fwts_method_valid_EISA_ID(
> +	const uint32_t id,
> +	char *buf,
> +	const size_t buf_len)
>  {
>  	snprintf(buf, buf_len, "%c%c%c%02" PRIX32 "%02" PRIX32,
>  		0x40 + ((id >> 2) & 0x1f),
> 

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

Patch

diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
index 32c8f6bf..b818146e 100644
--- a/src/lib/include/fwts_acpi_object_eval.h
+++ b/src/lib/include/fwts_acpi_object_eval.h
@@ -32,12 +32,14 @@  int fwts_acpi_deinit(fwts_framework *fw);
 char *fwts_acpi_object_exists(const char *name);
 fwts_list *fwts_acpi_object_get_names(void);
 void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj);
-void fwts_acpi_object_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
-ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
+void fwts_acpi_object_evaluate_report_error(fwts_framework *fw,
+	const char *name, const ACPI_STATUS status);
+ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw, char *name,
+	ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
 
 /* Test types */
 #define METHOD_MANDATORY	1
-#define METHOD_OPTIONAL	2
+#define METHOD_OPTIONAL		2
 #define METHOD_MOBILE		4
 #define METHOD_SILENT		8
 
@@ -112,43 +114,83 @@  typedef struct {
 #define fwts_method_package_elements_type(fw, name, obj, info)	\
 	fwts_method_package_elements_type__(fw, name, obj, info, FWTS_ARRAY_SIZE(info))
 
-int fwts_method_check_type__(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT_TYPE type, char *type_name);
-int fwts_method_check_element_type(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, uint32_t subpkg, uint32_t element, ACPI_OBJECT_TYPE type);
+int fwts_method_check_type__(fwts_framework *fw, const char *name,
+	const ACPI_BUFFER *buf, const ACPI_OBJECT_TYPE type,
+	const char *type_name);
+int fwts_method_check_element_type(fwts_framework *fw, const char *name,
+	const ACPI_OBJECT *obj, const uint32_t subpkg,
+	const uint32_t element, const ACPI_OBJECT_TYPE type);
 const char *fwts_method_type_name(const ACPI_OBJECT_TYPE type);
-void fwts_method_passed_sane(fwts_framework *fw, const char *name, const char *type);
-void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name, const uint64_t value);
-void fwts_method_failed_null_object(fwts_framework *fw, const char *name, const char *type);
-bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2);
-int fwts_method_buffer_size(fwts_framework *fw, const char *name, ACPI_OBJECT *obj, size_t buf_size);
-int fwts_method_package_count_min(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t min);
-int fwts_method_package_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t count);
-int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
-int fwts_method_package_elements_all_type(fwts_framework *fw, const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
-int fwts_method_package_elements_type__(fwts_framework *fw, const char *name, 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);
-void fwts_method_test_reference_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_NULL_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_buffer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
-void fwts_method_test_all_reference_package_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_integer_max_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_package_integer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_passed_failed_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_polling_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-
-void method_evaluate_found_method(fwts_framework *fw, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
-void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent, char *name, fwts_method_return check_func, void *private, ACPI_OBJECT_LIST *arg_list);
-int fwts_evaluate_method(fwts_framework *fw, uint32_t test_type, ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args, uint32_t num_args, fwts_method_return check_func, void *private);
-
-bool fwts_method_valid_HID_string(char *str);
-bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len);
-
-void fwts_method_test_CRS_large_size( fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t crs_length, const size_t min, const size_t max, bool *passed);
-void fwts_method_test_CRS_large_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const uint64_t length, bool *passed, const char **tag);
-void fwts_method_test_CRS_small_resource_items(fwts_framework *fw, const char *name, const char *objname, const uint8_t *data, const size_t length, bool *passed, const char **tag) ;
+void fwts_method_passed_sane(fwts_framework *fw, const char *name,
+	const char *type);
+void fwts_method_passed_sane_uint64(fwts_framework *fw, const char *name,
+	const uint64_t value);
+void fwts_method_failed_null_object(fwts_framework *fw, const char *name,
+	const char *type);
+bool fwts_method_type_matches(const ACPI_OBJECT_TYPE t1,
+	const ACPI_OBJECT_TYPE t2);
+int fwts_method_buffer_size(fwts_framework *fw, const char *name,
+	const ACPI_OBJECT *obj, const size_t buf_size);
+int fwts_method_package_count_min(fwts_framework *fw, const char *name,
+	const ACPI_OBJECT *obj, const uint32_t min);
+int fwts_method_package_count_equal(fwts_framework *fw, const char *name,
+	const ACPI_OBJECT *obj, const uint32_t count);
+int fwts_method_subpackage_count_equal(fwts_framework *fw, const char *name,
+	const ACPI_OBJECT *obj, const uint32_t sub, const uint32_t count);
+int fwts_method_package_elements_all_type(fwts_framework *fw,
+	const char *name, const ACPI_OBJECT *obj, const ACPI_OBJECT_TYPE type);
+int fwts_method_package_elements_type__(fwts_framework *fw, const char *name,
+	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);
+void fwts_method_test_reference_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NULL_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_buffer_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
+void fwts_method_test_all_reference_package_return(fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_integer_reserved_bits_return(fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_integer_max_return(fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_package_integer_return(fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_passed_failed_return(fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_polling_return( fwts_framework *fw,
+	char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+
+void method_evaluate_found_method(fwts_framework *fw,
+	char *name, fwts_method_return check_func, void *private,
+	ACPI_OBJECT_LIST *arg_list);
+void fwts_evaluate_found_method(fwts_framework *fw, ACPI_HANDLE *parent,
+	char *name, fwts_method_return check_func, void *private,
+	ACPI_OBJECT_LIST *arg_list);
+int fwts_evaluate_method(fwts_framework *fw, const uint32_t test_type,
+	ACPI_HANDLE *parent, char *name, ACPI_OBJECT *args,
+	uint32_t num_args, fwts_method_return check_func, void *private);
+
+bool fwts_method_valid_HID_string(const char *str);
+bool fwts_method_valid_EISA_ID(const uint32_t id, char *buf,
+	const size_t buf_len);
+
+void fwts_method_test_CRS_large_size(fwts_framework *fw, const char *name,
+	const char *objname, const uint8_t *data, const size_t crs_length,
+	const size_t min, const size_t max, bool *passed);
+void fwts_method_test_CRS_large_resource_items(fwts_framework *fw,
+	const char *name, const char *objname, const uint8_t *data,
+	const uint64_t length, bool *passed, const char **tag);
+void fwts_method_test_CRS_small_resource_items(fwts_framework *fw,
+	const char *name, const char *objname, const uint8_t *data,
+	const size_t length, bool *passed, const char **tag) ;
 
 /* Device Identification Objects - see Section 6 Device Configuration */
 int fwts_method_test_ADR(fwts_framework *fw, ACPI_HANDLE *device);
@@ -164,26 +206,45 @@  int fwts_method_test_SUN(fwts_framework *fw, ACPI_HANDLE *device);
 int fwts_method_test_STR(fwts_framework *fw, ACPI_HANDLE *device);
 int fwts_method_test_UID(fwts_framework *fw, ACPI_HANDLE *device);
 
-void fwts_method_test_BMD_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_BPC_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_BPS_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_valid_CID_Type(fwts_framework *fw, char *name, ACPI_OBJECT *obj);
-void fwts_method_test_CID_return(fwts_framework *fw, char *name,ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_HID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_MLS_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_PLD_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_SUB_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_UID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-
-void fwts_method_test_NBS_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_NCH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_NIC_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_NIH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_NIG_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-
-void fwts_method_test_STA_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_BIF_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_BIX_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
-void fwts_method_test_BST_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BMD_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BPC_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BPS_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_valid_CID_Type(fwts_framework *fw, char *name,
+	ACPI_OBJECT *obj);
+void fwts_method_test_CID_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_HID_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_MLS_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_PLD_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_SUB_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_UID_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+
+void fwts_method_test_NBS_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NCH_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIC_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIH_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIG_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+
+void fwts_method_test_STA_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BIF_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BIX_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_BST_return(fwts_framework *fw, char *name,
+	ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
 
 #endif
diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
index 020ff3c5..36b92734 100644
--- a/src/lib/src/fwts_acpi_object_eval.c
+++ b/src/lib/src/fwts_acpi_object_eval.c
@@ -474,10 +474,10 @@  ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
 
 int fwts_method_check_type__(
 	fwts_framework *fw,
-	char *name,
-	ACPI_BUFFER *buf,
-	ACPI_OBJECT_TYPE type,
-	char *type_name)
+	const char *name,
+	const ACPI_BUFFER *buf,
+	const ACPI_OBJECT_TYPE type,
+	const char *type_name)
 {
 	ACPI_OBJECT *obj;
 
@@ -548,10 +548,10 @@  static const char *acpi_object_names[] = {
 int fwts_method_check_element_type(
 	fwts_framework *fw,
 	const char *name,
-	ACPI_OBJECT *obj,
-	uint32_t subpkg,
-	uint32_t element,
-	ACPI_OBJECT_TYPE type)
+	const ACPI_OBJECT *obj,
+	const uint32_t subpkg,
+	const uint32_t element,
+	const ACPI_OBJECT_TYPE type)
 {
 	if (obj->Package.Elements[element].Type != type) {
 		char obj_name[5] = "_XYZ";
@@ -642,7 +642,9 @@  void fwts_method_failed_null_object(
 		"return %s.", name, type);
 }
 
-bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
+bool fwts_method_type_matches(
+	const ACPI_OBJECT_TYPE t1,
+	const ACPI_OBJECT_TYPE t2)
 {
 	if (t1 == ACPI_TYPE_INTBUF &&
 	    (t2 == ACPI_TYPE_INTEGER || t2 == ACPI_TYPE_BUFFER))
@@ -662,8 +664,8 @@  bool fwts_method_type_matches(ACPI_OBJECT_TYPE t1, ACPI_OBJECT_TYPE t2)
 int fwts_method_buffer_size(
 	fwts_framework *fw,
 	const char *name,
-	ACPI_OBJECT *obj,
-	size_t buf_size)
+	const ACPI_OBJECT *obj,
+	const size_t buf_size)
 {
 	if (obj->Buffer.Length != buf_size) {
 		fwts_failed(fw, LOG_LEVEL_CRITICAL,
@@ -1176,7 +1178,7 @@  void fwts_evaluate_found_method(
 }
 
 int fwts_evaluate_method(fwts_framework *fw,
-	uint32_t test_type,  /* Manditory or optional */
+	const uint32_t test_type,  /* Manditory or optional */
 	ACPI_HANDLE *parent,
 	char *name,
 	ACPI_OBJECT *args,
@@ -1210,7 +1212,7 @@  int fwts_evaluate_method(fwts_framework *fw,
 	return FWTS_OK;
 }
 
-bool fwts_method_valid_HID_string(char *str)
+bool fwts_method_valid_HID_string(const char *str)
 {
 	if (strlen(str) == 7) {
 		/* PNP ID, must be 3 capitals followed by 4 hex */
@@ -1240,7 +1242,10 @@  bool fwts_method_valid_HID_string(char *str)
 	return false;
 }
 
-bool fwts_method_valid_EISA_ID(uint32_t id, char *buf, size_t buf_len)
+bool fwts_method_valid_EISA_ID(
+	const uint32_t id,
+	char *buf,
+	const size_t buf_len)
 {
 	snprintf(buf, buf_len, "%c%c%c%02" PRIX32 "%02" PRIX32,
 		0x40 + ((id >> 2) & 0x1f),