OSDN Git Service

greybus: endo: Add missing '\n' sprintf() for sysfs files
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 1 Jun 2015 12:13:36 +0000 (17:43 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 4 Jun 2015 05:02:38 +0000 (14:02 +0900)
Because of the missing '\n', this is how the output of reading endo
sysfs files looks:

root# cat /sys/bus/greybus/devices/endo/id
0x4755root#

Fix it by including \n to the end of the printed string.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/endo.c

index d71f328..4f9ae4b 100644 (file)
@@ -49,7 +49,7 @@ static ssize_t serial_number_show(struct device *dev,
 {
        struct gb_endo *endo = to_gb_endo(dev);
 
-       return sprintf(buf, "%s", &endo->svc_info.serial_number[0]);
+       return sprintf(buf, "%s\n", &endo->svc_info.serial_number[0]);
 }
 static DEVICE_ATTR_RO(serial_number);
 
@@ -58,7 +58,7 @@ static ssize_t version_show(struct device *dev,
 {
        struct gb_endo *endo = to_gb_endo(dev);
 
-       return sprintf(buf, "%s", &endo->svc_info.version[0]);
+       return sprintf(buf, "%s\n", &endo->svc_info.version[0]);
 }
 static DEVICE_ATTR_RO(version);
 
@@ -78,7 +78,7 @@ static ssize_t id_show(struct device *dev,
 {
        struct gb_endo *endo = to_gb_endo(dev);
 
-       return sprintf(buf, "0x%04x", endo->id);
+       return sprintf(buf, "0x%04x\n", endo->id);
 }
 static DEVICE_ATTR_RO(id);
 
@@ -87,7 +87,7 @@ static ssize_t ap_intf_id_show(struct device *dev,
 {
        struct gb_endo *endo = to_gb_endo(dev);
 
-       return sprintf(buf, "0x%02x", endo->ap_intf_id);
+       return sprintf(buf, "0x%02x\n", endo->ap_intf_id);
 }
 static DEVICE_ATTR_RO(ap_intf_id);