Patchwork [1/4] lib: fwts_apci_method: rename object evaluation functions

login
register
mail settings
Submitter Colin King
Date Dec. 15, 2012, 11:48 p.m.
Message ID <1355615318-28765-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/206645/
State Accepted
Headers show

Comments

Colin King - Dec. 15, 2012, 11:48 p.m.
From: Colin Ian King <colin.king@canonical.com>

The ACPI object evaluation function names really are not well
named.  Rename them to something more sensible:

fwts_method_init() -> fwts_acpi_init()
fwts_method_deinit() -> fwts_acpi_deinit()
fwts_method_exists() -> fwts_acpi_object_exists()
fwts_method_get_names() -> fwts_acpi_object_get_names()
fwts_method_dump_object() -> fwtss_acpi_object_dump()
fwts_method_evaluate_report_error() -> fwts_acpi_object_evaluate_report_error()
fwts_method_evaluate() -> fwts_acpi_object_evaluate()

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_acpi_method.h | 14 ++++++------
 src/lib/src/fwts_acpi_method.c     | 46 +++++++++++++++++++-------------------
 2 files changed, 30 insertions(+), 30 deletions(-)
Keng-Yu Lin - Dec. 18, 2012, 3:48 a.m.
On Sun, Dec 16, 2012 at 7:48 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The ACPI object evaluation function names really are not well
> named.  Rename them to something more sensible:
>
> fwts_method_init() -> fwts_acpi_init()
> fwts_method_deinit() -> fwts_acpi_deinit()
> fwts_method_exists() -> fwts_acpi_object_exists()
> fwts_method_get_names() -> fwts_acpi_object_get_names()
> fwts_method_dump_object() -> fwtss_acpi_object_dump()
> fwts_method_evaluate_report_error() -> fwts_acpi_object_evaluate_report_error()
> fwts_method_evaluate() -> fwts_acpi_object_evaluate()
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts_acpi_method.h | 14 ++++++------
>  src/lib/src/fwts_acpi_method.c     | 46 +++++++++++++++++++-------------------
>  2 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/src/lib/include/fwts_acpi_method.h b/src/lib/include/fwts_acpi_method.h
> index 0313ceb..76e3e46 100644
> --- a/src/lib/include/fwts_acpi_method.h
> +++ b/src/lib/include/fwts_acpi_method.h
> @@ -25,12 +25,12 @@
>  /* acpica headers */
>  #include "acpi.h"
>
> -int fwts_method_init(fwts_framework *fw);
> -int fwts_method_deinit(fwts_framework *fw);
> -char *fwts_method_exists(const char *name);
> -fwts_list *fwts_method_get_names(void);
> -void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj);
> -void fwts_method_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
> -ACPI_STATUS fwts_method_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
> +int fwts_acpi_init(fwts_framework *fw);
> +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);
>
>  #endif
> diff --git a/src/lib/src/fwts_acpi_method.c b/src/lib/src/fwts_acpi_method.c
> index 5a66b6d..8427e4c 100644
> --- a/src/lib/src/fwts_acpi_method.c
> +++ b/src/lib/src/fwts_acpi_method.c
> @@ -110,59 +110,59 @@ static const acpi_eval_error errors[] = {
>  };
>
>  static fwts_list *fwts_object_names;
> -static bool fwts_method_initialized = false;
> +static bool fwts_acpi_initialized = false;
>
>  /*
> - *  fwts_method_init()
> + *  fwts_acpi_init()
>   *     Initialise ACPIA engine and collect method namespace
>   */
> -int fwts_method_init(fwts_framework *fw)
> +int fwts_acpi_init(fwts_framework *fw)
>  {
>         if (fwts_acpica_init(fw) != FWTS_OK)
>                 return FWTS_ERROR;
>
>         /* Gather all object names */
>         fwts_object_names = fwts_acpica_get_object_names(0);
> -       fwts_method_initialized = true;
> +       fwts_acpi_initialized = true;
>
>         return FWTS_OK;
>  }
>
>  /*
> - *  fwts_method_deinit()
> + *  fwts_acpi_deinit()
>   *     Close ACPIA engine and free method namespace
>   */
> -int fwts_method_deinit(fwts_framework *fw)
> +int fwts_acpi_deinit(fwts_framework *fw)
>  {
>         int ret = FWTS_ERROR;
>
>         FWTS_UNUSED(fw);
>
> -       if (fwts_method_initialized) {
> +       if (fwts_acpi_initialized) {
>                 fwts_list_free(fwts_object_names, free);
>                 fwts_object_names = NULL;
>                 ret = fwts_acpica_deinit();
>
> -               fwts_method_initialized = false;
> +               fwts_acpi_initialized = false;
>         }
>
>         return ret;
>  }
>
>  /*
> - *  fwts_method_get_names()
> - *     return list of method names
> + *  fwts_acpi_object_get_names()
> + *     return list of object names
>   */
> -fwts_list *fwts_method_get_names(void)
> +fwts_list *fwts_acpi_object_get_names(void)
>  {
>         return fwts_object_names;
>  }
>
>  /*
> - *  fwts_method_exists()
> + *  fwts_acpi_object_exists()
>   *     return first matching name
>   */
> -char *fwts_method_exists(const char *name)
> +char *fwts_acpi_object_exists(const char *name)
>  {
>         size_t name_len = strlen(name);
>         fwts_list_link  *item;
> @@ -179,10 +179,10 @@ char *fwts_method_exists(const char *name)
>
>
>  /*
> - *   fwts_method_dump_object()
> + *   fwts_acpi_object_dump_recursive()
>   *     dump out an object, minimal form
>   */
> -static void fwts_method_dump_object_recursive(
> +static void fwts_acpi_object_dump_recursive(
>         fwts_framework *fw,
>         const ACPI_OBJECT *obj,
>         const int depth,
> @@ -214,7 +214,7 @@ static void fwts_method_dump_object_recursive(
>                         index_buf, obj->Package.Count);
>                 for (i = 0; i < obj->Package.Count; i++) {
>                         ACPI_OBJECT *element = &obj->Package.Elements[i];
> -                       fwts_method_dump_object_recursive(fw, element, depth + 1, i);
> +                       fwts_acpi_object_dump_recursive(fw, element, depth + 1, i);
>                 }
>                 break;
>         default:
> @@ -225,19 +225,19 @@ static void fwts_method_dump_object_recursive(
>  }
>
>  /*
> - *   fwts_method_dump_object()
> + *   fwts_method_object_dump()
>   *     dump out an object, minimal form
>   */
> -void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj)
> +void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj)
>  {
> -       fwts_method_dump_object_recursive(fw, obj, 1, -1);
> +       fwts_acpi_object_dump_recursive(fw, obj, 1, -1);
>  }
>
>  /*
> - *  fwts_method_evaluate_report_error()
> + *  fwts_acpi_object_evaluate_report_error()
>   *     report any errors found during object evaluation
>   */
> -void fwts_method_evaluate_report_error(
> +void fwts_acpi_object_evaluate_report_error(
>         fwts_framework *fw,
>         const char *name,
>         const ACPI_STATUS status)
> @@ -274,13 +274,13 @@ void fwts_method_evaluate_report_error(
>  }
>
>  /*
> - *  fwts_method_evaluate()
> + *  fwts_acpi_object_evaluate()
>   *     evaluate object, return error status (handle this with
>   *     fwts_method_evaluate_report_error()).
>   *     This returns buf which auto allocates any return values
>   *     which need to be freed post-evalutation using free().
>   */
> -ACPI_STATUS fwts_method_evaluate(fwts_framework *fw,
> +ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
>         char *name,
>          ACPI_OBJECT_LIST *arg_list,
>         ACPI_BUFFER      *buf)
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - Dec. 21, 2012, 2:04 a.m.
On 12/16/2012 07:48 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The ACPI object evaluation function names really are not well
> named.  Rename them to something more sensible:
>
> fwts_method_init() -> fwts_acpi_init()
> fwts_method_deinit() -> fwts_acpi_deinit()
> fwts_method_exists() -> fwts_acpi_object_exists()
> fwts_method_get_names() -> fwts_acpi_object_get_names()
> fwts_method_dump_object() -> fwtss_acpi_object_dump()
> fwts_method_evaluate_report_error() -> fwts_acpi_object_evaluate_report_error()
> fwts_method_evaluate() -> fwts_acpi_object_evaluate()
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts_acpi_method.h | 14 ++++++------
>   src/lib/src/fwts_acpi_method.c     | 46 +++++++++++++++++++-------------------
>   2 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/src/lib/include/fwts_acpi_method.h b/src/lib/include/fwts_acpi_method.h
> index 0313ceb..76e3e46 100644
> --- a/src/lib/include/fwts_acpi_method.h
> +++ b/src/lib/include/fwts_acpi_method.h
> @@ -25,12 +25,12 @@
>   /* acpica headers */
>   #include "acpi.h"
>
> -int fwts_method_init(fwts_framework *fw);
> -int fwts_method_deinit(fwts_framework *fw);
> -char *fwts_method_exists(const char *name);
> -fwts_list *fwts_method_get_names(void);
> -void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj);
> -void fwts_method_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
> -ACPI_STATUS fwts_method_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
> +int fwts_acpi_init(fwts_framework *fw);
> +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);
>
>   #endif
> diff --git a/src/lib/src/fwts_acpi_method.c b/src/lib/src/fwts_acpi_method.c
> index 5a66b6d..8427e4c 100644
> --- a/src/lib/src/fwts_acpi_method.c
> +++ b/src/lib/src/fwts_acpi_method.c
> @@ -110,59 +110,59 @@ static const acpi_eval_error errors[] = {
>   };
>
>   static fwts_list *fwts_object_names;
> -static bool fwts_method_initialized = false;
> +static bool fwts_acpi_initialized = false;
>
>   /*
> - *  fwts_method_init()
> + *  fwts_acpi_init()
>    *	Initialise ACPIA engine and collect method namespace
>    */
> -int fwts_method_init(fwts_framework *fw)
> +int fwts_acpi_init(fwts_framework *fw)
>   {
>   	if (fwts_acpica_init(fw) != FWTS_OK)
>   		return FWTS_ERROR;
>
>   	/* Gather all object names */
>   	fwts_object_names = fwts_acpica_get_object_names(0);
> -	fwts_method_initialized = true;
> +	fwts_acpi_initialized = true;
>
>   	return FWTS_OK;
>   }
>
>   /*
> - *  fwts_method_deinit()
> + *  fwts_acpi_deinit()
>    *	Close ACPIA engine and free method namespace
>    */
> -int fwts_method_deinit(fwts_framework *fw)
> +int fwts_acpi_deinit(fwts_framework *fw)
>   {
>   	int ret = FWTS_ERROR;
>
>   	FWTS_UNUSED(fw);
>
> -	if (fwts_method_initialized) {
> +	if (fwts_acpi_initialized) {
>   		fwts_list_free(fwts_object_names, free);
>   		fwts_object_names = NULL;
>   		ret = fwts_acpica_deinit();
>
> -		fwts_method_initialized = false;
> +		fwts_acpi_initialized = false;
>   	}
>
>   	return ret;
>   }
>
>   /*
> - *  fwts_method_get_names()
> - *	return list of method names
> + *  fwts_acpi_object_get_names()
> + *	return list of object names
>    */
> -fwts_list *fwts_method_get_names(void)
> +fwts_list *fwts_acpi_object_get_names(void)
>   {
>   	return fwts_object_names;
>   }
>
>   /*
> - *  fwts_method_exists()
> + *  fwts_acpi_object_exists()
>    *	return first matching name
>    */
> -char *fwts_method_exists(const char *name)
> +char *fwts_acpi_object_exists(const char *name)
>   {
>   	size_t name_len = strlen(name);
>   	fwts_list_link	*item;
> @@ -179,10 +179,10 @@ char *fwts_method_exists(const char *name)
>
>
>   /*
> - *   fwts_method_dump_object()
> + *   fwts_acpi_object_dump_recursive()
>    *	dump out an object, minimal form
>    */
> -static void fwts_method_dump_object_recursive(
> +static void fwts_acpi_object_dump_recursive(
>   	fwts_framework *fw,
>   	const ACPI_OBJECT *obj,
>   	const int depth,
> @@ -214,7 +214,7 @@ static void fwts_method_dump_object_recursive(
>   			index_buf, obj->Package.Count);
>   		for (i = 0; i < obj->Package.Count; i++) {
>   			ACPI_OBJECT *element = &obj->Package.Elements[i];
> -			fwts_method_dump_object_recursive(fw, element, depth + 1, i);
> +			fwts_acpi_object_dump_recursive(fw, element, depth + 1, i);
>   		}
>   		break;
>   	default:
> @@ -225,19 +225,19 @@ static void fwts_method_dump_object_recursive(
>   }
>
>   /*
> - *   fwts_method_dump_object()
> + *   fwts_method_object_dump()
>    *	dump out an object, minimal form
>    */
> -void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj)
> +void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj)
>   {
> -	fwts_method_dump_object_recursive(fw, obj, 1, -1);
> +	fwts_acpi_object_dump_recursive(fw, obj, 1, -1);
>   }
>
>   /*
> - *  fwts_method_evaluate_report_error()
> + *  fwts_acpi_object_evaluate_report_error()
>    *	report any errors found during object evaluation
>    */
> -void fwts_method_evaluate_report_error(
> +void fwts_acpi_object_evaluate_report_error(
>   	fwts_framework *fw,
>   	const char *name,
>   	const ACPI_STATUS status)
> @@ -274,13 +274,13 @@ void fwts_method_evaluate_report_error(
>   }
>
>   /*
> - *  fwts_method_evaluate()
> + *  fwts_acpi_object_evaluate()
>    *	evaluate object, return error status (handle this with
>    *	fwts_method_evaluate_report_error()).
>    * 	This returns buf which auto allocates any return values
>    *	which need to be freed post-evalutation using free().
>    */
> -ACPI_STATUS fwts_method_evaluate(fwts_framework *fw,
> +ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
>   	char *name,
>           ACPI_OBJECT_LIST *arg_list,
>   	ACPI_BUFFER	 *buf)
>
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/lib/include/fwts_acpi_method.h b/src/lib/include/fwts_acpi_method.h
index 0313ceb..76e3e46 100644
--- a/src/lib/include/fwts_acpi_method.h
+++ b/src/lib/include/fwts_acpi_method.h
@@ -25,12 +25,12 @@ 
 /* acpica headers */
 #include "acpi.h"
 
-int fwts_method_init(fwts_framework *fw);
-int fwts_method_deinit(fwts_framework *fw);
-char *fwts_method_exists(const char *name);
-fwts_list *fwts_method_get_names(void);
-void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj);
-void fwts_method_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
-ACPI_STATUS fwts_method_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
+int fwts_acpi_init(fwts_framework *fw);
+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);
 
 #endif
diff --git a/src/lib/src/fwts_acpi_method.c b/src/lib/src/fwts_acpi_method.c
index 5a66b6d..8427e4c 100644
--- a/src/lib/src/fwts_acpi_method.c
+++ b/src/lib/src/fwts_acpi_method.c
@@ -110,59 +110,59 @@  static const acpi_eval_error errors[] = {
 };
 
 static fwts_list *fwts_object_names;
-static bool fwts_method_initialized = false;
+static bool fwts_acpi_initialized = false;
 
 /*
- *  fwts_method_init()
+ *  fwts_acpi_init()
  *	Initialise ACPIA engine and collect method namespace
  */
-int fwts_method_init(fwts_framework *fw)
+int fwts_acpi_init(fwts_framework *fw)
 {
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
 	/* Gather all object names */
 	fwts_object_names = fwts_acpica_get_object_names(0);
-	fwts_method_initialized = true;
+	fwts_acpi_initialized = true;
 
 	return FWTS_OK;
 }
 
 /*
- *  fwts_method_deinit()
+ *  fwts_acpi_deinit()
  *	Close ACPIA engine and free method namespace
  */
-int fwts_method_deinit(fwts_framework *fw)
+int fwts_acpi_deinit(fwts_framework *fw)
 {
 	int ret = FWTS_ERROR;
 
 	FWTS_UNUSED(fw);
 
-	if (fwts_method_initialized) {
+	if (fwts_acpi_initialized) {
 		fwts_list_free(fwts_object_names, free);
 		fwts_object_names = NULL;
 		ret = fwts_acpica_deinit();
 
-		fwts_method_initialized = false;
+		fwts_acpi_initialized = false;
 	}
 
 	return ret;
 }
 
 /*
- *  fwts_method_get_names()
- *	return list of method names
+ *  fwts_acpi_object_get_names()
+ *	return list of object names
  */
-fwts_list *fwts_method_get_names(void)
+fwts_list *fwts_acpi_object_get_names(void)
 {
 	return fwts_object_names;
 }
 
 /*
- *  fwts_method_exists()
+ *  fwts_acpi_object_exists()
  *	return first matching name
  */
-char *fwts_method_exists(const char *name)
+char *fwts_acpi_object_exists(const char *name)
 {
 	size_t name_len = strlen(name);
 	fwts_list_link	*item;
@@ -179,10 +179,10 @@  char *fwts_method_exists(const char *name)
 
 
 /*
- *   fwts_method_dump_object()
+ *   fwts_acpi_object_dump_recursive()
  *	dump out an object, minimal form
  */
-static void fwts_method_dump_object_recursive(
+static void fwts_acpi_object_dump_recursive(
 	fwts_framework *fw,
 	const ACPI_OBJECT *obj,
 	const int depth,
@@ -214,7 +214,7 @@  static void fwts_method_dump_object_recursive(
 			index_buf, obj->Package.Count);
 		for (i = 0; i < obj->Package.Count; i++) {
 			ACPI_OBJECT *element = &obj->Package.Elements[i];
-			fwts_method_dump_object_recursive(fw, element, depth + 1, i);
+			fwts_acpi_object_dump_recursive(fw, element, depth + 1, i);
 		}
 		break;
 	default:
@@ -225,19 +225,19 @@  static void fwts_method_dump_object_recursive(
 }
 
 /*
- *   fwts_method_dump_object()
+ *   fwts_method_object_dump()
  *	dump out an object, minimal form
  */
-void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj)
+void fwts_acpi_object_dump(fwts_framework *fw, const ACPI_OBJECT *obj)
 {
-	fwts_method_dump_object_recursive(fw, obj, 1, -1);
+	fwts_acpi_object_dump_recursive(fw, obj, 1, -1);
 }
 
 /*
- *  fwts_method_evaluate_report_error()
+ *  fwts_acpi_object_evaluate_report_error()
  *	report any errors found during object evaluation
  */
-void fwts_method_evaluate_report_error(
+void fwts_acpi_object_evaluate_report_error(
 	fwts_framework *fw,
 	const char *name,
 	const ACPI_STATUS status)
@@ -274,13 +274,13 @@  void fwts_method_evaluate_report_error(
 }
 
 /*
- *  fwts_method_evaluate()
+ *  fwts_acpi_object_evaluate()
  *	evaluate object, return error status (handle this with
  *	fwts_method_evaluate_report_error()).
  * 	This returns buf which auto allocates any return values
  *	which need to be freed post-evalutation using free().
  */
-ACPI_STATUS fwts_method_evaluate(fwts_framework *fw,
+ACPI_STATUS fwts_acpi_object_evaluate(fwts_framework *fw,
 	char *name,
         ACPI_OBJECT_LIST *arg_list,
 	ACPI_BUFFER	 *buf)