From b5b9500a62515b65725fa8f9b4b4428fd982e000 Mon Sep 17 00:00:00 2001
From: "Christopher N. Hesse" <raymanfx@gmail.com>
Date: Sat, 4 Mar 2017 15:04:16 +0100
Subject: [PATCH] lights: Remove superfluous log newlines

Change-Id: Id1522dfe92c9e585000edd7067b50968f38c07ca
---
 liblights/lights.c        | 10 +++-------
 liblights/lights_helper.c |  8 ++++----
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/liblights/lights.c b/liblights/lights.c
index f7d1d60..7af7702 100644
--- a/liblights/lights.c
+++ b/liblights/lights.c
@@ -99,7 +99,7 @@ static int write_str(char const *path, const char* value)
         return amt == -1 ? -errno : 0;
     } else {
         if (already_warned == 0) {
-            ALOGE("write_str failed to open %s\n", path);
+            ALOGE("write_str failed to open %s", path);
             already_warned = 1;
         }
         return -errno;
@@ -128,7 +128,7 @@ static int set_light_backlight(struct light_device_t *dev __unused,
     if (max_brightness > MAX_INPUT_BRIGHTNESS) {
         int old_brightness = brightness;
         brightness = brightness * max_brightness / MAX_INPUT_BRIGHTNESS;
-        ALOGV("%s: scaling brightness %d => %d\n", __func__,
+        ALOGV("%s: scaling brightness %d => %d", __func__,
             old_brightness, brightness);
     }
 
@@ -190,13 +190,9 @@ static int write_leds(const struct led_config *led)
         return -EINVAL;
     }
 
-    ALOGV("%s: color=0x%08x, delay_on=%d, delay_off=%d, blink=\"%s\".",
+    ALOGV("%s: color=0x%08x, delay_on=%d, delay_off=%d, blink=%s",
           __func__, led->color, led->delay_on, led->delay_off, blink);
 
-    /* Add '\n' here to make the above log message clean. */
-    blink[count]   = '\n';
-    blink[count+1] = '\0';
-
     pthread_mutex_lock(&g_lock);
     err = write_str(LED_BLINK_NODE, blink);
     pthread_mutex_unlock(&g_lock);
diff --git a/liblights/lights_helper.c b/liblights/lights_helper.c
index c3406ab..5fb4af1 100644
--- a/liblights/lights_helper.c
+++ b/liblights/lights_helper.c
@@ -39,13 +39,13 @@ int read_int(char const *path)
 
     fd = open(path, O_RDONLY);
     if (fd < 0) {
-        ALOGE("%s: failed to open %s\n", __func__, path);
+        ALOGE("%s: failed to open %s", __func__, path);
         goto fail;
     }
 
     len = read(fd, buf, num_bytes - 1);
     if (len < 0) {
-        ALOGE("%s: failed to read from %s\n", __func__, path);
+        ALOGE("%s: failed to read from %s", __func__, path);
         goto fail;
     }
 
@@ -81,13 +81,13 @@ int write_int(char const *path, const int value)
 
     if (fd >= 0) {
         char buffer[20];
-        int bytes = sprintf(buffer, "%d\n", value);
+        int bytes = sprintf(buffer, "%d", value);
         int amt = write(fd, buffer, bytes);
         close(fd);
         return amt == -1 ? -errno : 0;
     } else {
         if (already_warned == 0) {
-            ALOGE("write_int failed to open %s\n", path);
+            ALOGE("write_int failed to open %s", path);
             already_warned = 1;
         }
         return -errno;
-- 
2.20.1