From: Seunghun Lee Date: Tue, 2 Aug 2022 01:13:51 +0000 (+0900) Subject: output: Cleanup code X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8c4eafe71da9d54592bce3d4a7d90d7102789d2;p=platform%2Fcore%2Fuifw%2Fheadless-server.git output: Cleanup code No functional changes Change-Id: I0c5c75b27ba99315f63b6ec5431564ffbbc95946 --- diff --git a/src/output/output_internal.h b/src/output/output_internal.h index 1404c2e..c4973fb 100644 --- a/src/output/output_internal.h +++ b/src/output/output_internal.h @@ -28,8 +28,6 @@ #include "HL_UI_LED.h" -#define NUM_LED 12 - typedef struct led_output led_output_t; typedef struct boot_ani boot_ani_t; @@ -38,7 +36,6 @@ struct led_output { struct wl_display *display; struct ds_tbm_server *tbm_server; - int num_led; HL_UI_LED *ui_led; struct wl_event_source *frame_done; diff --git a/src/output/output_led.c b/src/output/output_led.c index dd99103..455ea18 100644 --- a/src/output/output_led.c +++ b/src/output/output_led.c @@ -28,31 +28,31 @@ #include #include "headless_server.h" -#include "HL_UI_LED.h" #include "output_internal.h" +#define NUM_LED 12 +#define LED_BRIGHTNESS 0x1 + led_output_t * headless_output_create(struct wl_display *display) { - led_output_t *output = (led_output_t*)calloc(sizeof(led_output_t), 1); + led_output_t *output; HS_TRACE("Output Init\n"); + output = calloc(1, sizeof(led_output_t)); if (!output) { - HS_ERROR("Failed to allocate memory in %s\n", __FUNCTION__); + HS_ERROR("Failed to allocate memory\n"); return false; } output->display = display; - // FIXME Should we create wl_global for wl_output? - - output->num_led = NUM_LED; - output->ui_led = HL_UI_LED_Init(output->num_led); - if (output->ui_led) HL_UI_LED_Change_Brightness(output->ui_led, 0x1); - - if (!output->ui_led) - HS_ERROR("HL_UI_LED_Init() failed.\n"); + output->ui_led = HL_UI_LED_Init(NUM_LED); + if (output->ui_led) + HL_UI_LED_Change_Brightness(output->ui_led, LED_BRIGHTNESS); + else + HS_ERROR("HL_UI_LED_Init() failed."); return output; } @@ -82,13 +82,13 @@ headless_output_update_led(led_output_t *output, unsigned char *data) int i; uint8_t *ptr = (uint8_t *)data; - if (data == NULL) { + if (!ptr) { HS_TRACE("[OUTPUT] update LED to empty\n"); HL_UI_LED_Clear_All(output->ui_led); return; } - for(i=0; inum_led; i++) { + for (i = 0; i < NUM_LED; i++) { HL_UI_LED_Set_Pixel_RGB(output->ui_led, i, ptr[R_OFF_SET], ptr[G_OFF_SET], ptr[B_OFF_SET]); ptr += 4;