[PATCH] lib: fwts_button: make button counts and button number uint32_t
Colin King
colin.king at canonical.com
Fri Sep 8 09:29:30 UTC 2017
From: Colin Ian King <colin.king at canonical.com>
There is no practical need for -ve button counts and button numbers
so make these uint32_t types.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpi/lid/lid.c | 21 ++++++++++++---------
src/lib/include/fwts_button.h | 2 +-
src/lib/src/fwts_button.c | 12 ++++++------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/acpi/lid/lid.c b/src/acpi/lid/lid.c
index 93e031c0..2542051e 100644
--- a/src/acpi/lid/lid.c
+++ b/src/acpi/lid/lid.c
@@ -31,7 +31,7 @@
static int lid_init(fwts_framework *fw)
{
- int matched, not_matched;
+ uint32_t matched, not_matched;
if (fwts_button_match_state(fw, FWTS_BUTTON_LID_ANY, &matched, ¬_matched) != FWTS_OK) {
fwts_failed(fw, LOG_LEVEL_LOW, "NoLIDPath",
@@ -41,13 +41,16 @@ static int lid_init(fwts_framework *fw)
return FWTS_OK;
}
-static void lid_check_field_poll(fwts_framework *fw,
- int button, int *matching, int *not_matching)
+static void lid_check_field_poll(
+ fwts_framework *fw,
+ const uint32_t button,
+ uint32_t *matching,
+ uint32_t *not_matching)
{
int i;
- int tmp_matching = 0;
- int tmp_not_matching = 0;
+ uint32_t tmp_matching = 0;
+ uint32_t tmp_not_matching = 0;
for (i = 0; i < 100; i++) {
fwts_button_match_state(fw, button,
@@ -63,8 +66,8 @@ static void lid_check_field_poll(fwts_framework *fw,
static int lid_test1(fwts_framework *fw)
{
- int matching = 0;
- int not_matching = 0;
+ uint32_t matching = 0;
+ uint32_t not_matching = 0;
fwts_printf(fw, "==== Make sure laptop lid is open. ====\n");
fwts_press_enter(fw);
@@ -84,8 +87,8 @@ static int lid_test_state(fwts_framework *fw, int button)
{
int gpe_count = 0;
int fd;
- int matching = 0;
- int not_matching = 0;
+ uint32_t matching = 0;
+ uint32_t not_matching = 0;
int events = 0;
size_t len;
char *state;
diff --git a/src/lib/include/fwts_button.h b/src/lib/include/fwts_button.h
index 5130c0c8..bc475e91 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, const int button, int *matched, int *not_matched);
+int fwts_button_match_state(fwts_framework *fw, const uint32_t button, uint32_t *matched, uint32_t *not_matched);
#endif
diff --git a/src/lib/src/fwts_button.c b/src/lib/src/fwts_button.c
index 6e9a0101..c9fa8ee2 100644
--- a/src/lib/src/fwts_button.c
+++ b/src/lib/src/fwts_button.c
@@ -35,9 +35,9 @@
* any non-matching states found, via proc iterface
*/
static int fwts_button_match_state_proc(
- const int button,
- int *matched,
- int *not_matched)
+ const uint32_t button,
+ uint32_t *matched,
+ uint32_t *not_matched)
{
DIR *dir;
struct dirent *entry;
@@ -112,9 +112,9 @@ static int fwts_button_match_state_proc(
*/
int fwts_button_match_state(
fwts_framework *fw,
- const int button,
- int *matched,
- int *not_matched)
+ const uint32_t button,
+ uint32_t *matched,
+ uint32_t *not_matched)
{
*matched = 0;
*not_matched = 0;
--
2.14.1
More information about the fwts-devel
mailing list