diff --git a/src/tuxedo_keyboard_common.h b/src/tuxedo_keyboard_common.h index f613f39..3a52b2a 100644 --- a/src/tuxedo_keyboard_common.h +++ b/src/tuxedo_keyboard_common.h @@ -103,11 +103,11 @@ static struct color_list_t color_list = { /** * Looks up a color in the color_list * - * Returns found color, or -1 if string did not match + * Returns found color value, or 0xffffffff if string did not match */ static u32 color_lookup(const struct color_list_t *color_list, const char *color_name) { - u32 found_color = -1; + u32 found_color = 0xffffffff; int i; for (i = 0; i < color_list->size; ++i) { if (strcmp(color_list->colors[i].name, color_name) == 0) { diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 27670f8..77d8e25 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -308,7 +308,7 @@ static int uniwill_keyboard_probe(struct platform_device *dev) // Initialize keyboard backlight driver state according to parameters if (param_brightness > UNIWILL_BRIGHTNESS_MAX) param_brightness = UNIWILL_BRIGHTNESS_DEFAULT; kbd_led_state_uw.brightness = param_brightness; - if (color_lookup(&color_list, param_color) != -1) kbd_led_state_uw.color = color_lookup(&color_list, param_color); + if (color_lookup(&color_list, param_color) <= (u32) 0xffffff) kbd_led_state_uw.color = color_lookup(&color_list, param_color); else kbd_led_state_uw.color = UNIWILL_COLOR_DEFAULT; // Update keyboard according to the current state