Patchwork [06/11] lib: fwts_button: constify function arguments where appropriate

login
register
mail settings
Submitter Colin King
Date Oct. 16, 2012, 7:20 p.m.
Message ID <1350415248-16965-7-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/191860/
State Accepted
Headers show

Comments

Colin King - Oct. 16, 2012, 7:20 p.m.
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_button.h |    2 +-
 src/lib/src/fwts_button.c     |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
Keng-Yu Lin - Oct. 18, 2012, 6:49 a.m.
On Wed, Oct 17, 2012 at 3:20 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts_button.h |    2 +-
>  src/lib/src/fwts_button.c     |   11 +++++++++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/include/fwts_button.h b/src/lib/include/fwts_button.h
> index 56a4bdf..5c70cc5 100644
> --- a/src/lib/include/fwts_button.h
> +++ b/src/lib/include/fwts_button.h
> @@ -26,6 +26,6 @@
>
>  #define FWTS_BUTTON_POWER_EXISTS       (0x00010)
>
> -int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched);
> +int fwts_button_match_state(fwts_framework *fw, const int button, int *matched, int *not_matched);
>
>  #endif
> diff --git a/src/lib/src/fwts_button.c b/src/lib/src/fwts_button.c
> index c410d5f..2eb7d87 100644
> --- a/src/lib/src/fwts_button.c
> +++ b/src/lib/src/fwts_button.c
> @@ -34,7 +34,10 @@
>   *     find matching button state and keep count of matching
>   *     any non-matching states found, via proc iterface
>   */
> -static int fwts_button_match_state_proc(int button, int *matched, int *not_matched)
> +static int fwts_button_match_state_proc(
> +       const int button,
> +       int *matched,
> +       int *not_matched)
>  {
>         DIR *dir;
>         struct dirent *entry;
> @@ -106,7 +109,11 @@ static int fwts_button_match_state_proc(int button, int *matched, int *not_match
>   *     matched is a count of any button states that match, and not_matched
>   *     is a count of any button states that don't match.
>   */
> -int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched)
> +int fwts_button_match_state(
> +       fwts_framework *fw,
> +       const int button,
> +       int *matched,
> +       int *not_matched)
>  {
>         *matched = 0;
>         *not_matched = 0;
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - Oct. 22, 2012, 9:32 a.m.
On 10/17/2012 03:20 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts_button.h |    2 +-
>   src/lib/src/fwts_button.c     |   11 +++++++++--
>   2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/include/fwts_button.h b/src/lib/include/fwts_button.h
> index 56a4bdf..5c70cc5 100644
> --- a/src/lib/include/fwts_button.h
> +++ b/src/lib/include/fwts_button.h
> @@ -26,6 +26,6 @@
>
>   #define FWTS_BUTTON_POWER_EXISTS	(0x00010)
>
> -int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched);
> +int fwts_button_match_state(fwts_framework *fw, const int button, int *matched, int *not_matched);
>
>   #endif
> diff --git a/src/lib/src/fwts_button.c b/src/lib/src/fwts_button.c
> index c410d5f..2eb7d87 100644
> --- a/src/lib/src/fwts_button.c
> +++ b/src/lib/src/fwts_button.c
> @@ -34,7 +34,10 @@
>    *	find matching button state and keep count of matching
>    *	any non-matching states found, via proc iterface
>    */
> -static int fwts_button_match_state_proc(int button, int *matched, int *not_matched)
> +static int fwts_button_match_state_proc(
> +	const int button,
> +	int *matched,
> +	int *not_matched)
>   {
>   	DIR *dir;
>   	struct dirent *entry;
> @@ -106,7 +109,11 @@ static int fwts_button_match_state_proc(int button, int *matched, int *not_match
>    * 	matched is a count of any button states that match, and not_matched
>    *	is a count of any button states that don't match.
>    */
> -int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched)
> +int fwts_button_match_state(
> +	fwts_framework *fw,
> +	const int button,
> +	int *matched,
> +	int *not_matched)
>   {
>   	*matched = 0;
>   	*not_matched = 0;
>

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

Patch

diff --git a/src/lib/include/fwts_button.h b/src/lib/include/fwts_button.h
index 56a4bdf..5c70cc5 100644
--- a/src/lib/include/fwts_button.h
+++ b/src/lib/include/fwts_button.h
@@ -26,6 +26,6 @@ 
 
 #define FWTS_BUTTON_POWER_EXISTS	(0x00010)
 
-int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched);
+int fwts_button_match_state(fwts_framework *fw, const int button, int *matched, int *not_matched);
 
 #endif
diff --git a/src/lib/src/fwts_button.c b/src/lib/src/fwts_button.c
index c410d5f..2eb7d87 100644
--- a/src/lib/src/fwts_button.c
+++ b/src/lib/src/fwts_button.c
@@ -34,7 +34,10 @@ 
  *	find matching button state and keep count of matching
  *	any non-matching states found, via proc iterface
  */
-static int fwts_button_match_state_proc(int button, int *matched, int *not_matched)
+static int fwts_button_match_state_proc(
+	const int button,
+	int *matched,
+	int *not_matched)
 {
 	DIR *dir;
 	struct dirent *entry;
@@ -106,7 +109,11 @@  static int fwts_button_match_state_proc(int button, int *matched, int *not_match
  * 	matched is a count of any button states that match, and not_matched
  *	is a count of any button states that don't match.
  */
-int fwts_button_match_state(fwts_framework *fw, int button, int *matched, int *not_matched)
+int fwts_button_match_state(
+	fwts_framework *fw,
+	const int button,
+	int *matched,
+	int *not_matched)
 {
 	*matched = 0;
 	*not_matched = 0;