output: Cleanup code 03/279103/1
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 2 Aug 2022 01:13:51 +0000 (10:13 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Tue, 2 Aug 2022 04:16:54 +0000 (13:16 +0900)
No functional changes

Change-Id: I0c5c75b27ba99315f63b6ec5431564ffbbc95946

src/output/output_internal.h
src/output/output_led.c

index 1404c2e..c4973fb 100644 (file)
@@ -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;
index dd99103..455ea18 100644 (file)
 #include <unistd.h>
 
 #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; i<output->num_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;