greybus: interface: Prefix hexadecimal values with '0x'
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 18 Dec 2015 09:34:27 +0000 (15:04 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 22 Dec 2015 02:27:16 +0000 (18:27 -0800)
In order to clearly specify the base of values printed using sysfs
files, prefix hexadecimal values with '0x'. Also force the minimum width
(to be printed) for hexadecimal values to their sizes.

To make it more readable make the second argument to gb_interface_attr()
a proper string.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c

index ecc64bedbef5dbf55c729da5578f9987aa073380..c43992d783f4edb003f9d0ea1167844917f0401f 100644 (file)
@@ -16,15 +16,15 @@ static ssize_t field##_show(struct device *dev,                             \
                            char *buf)                                  \
 {                                                                      \
        struct gb_interface *intf = to_gb_interface(dev);               \
-       return scnprintf(buf, PAGE_SIZE, "%"#type"\n", intf->field);    \
+       return scnprintf(buf, PAGE_SIZE, type"\n", intf->field);        \
 }                                                                      \
 static DEVICE_ATTR_RO(field)
 
-gb_interface_attr(interface_id, u);
-gb_interface_attr(vendor_id, x);
-gb_interface_attr(product_id, x);
-gb_interface_attr(vendor_string, s);
-gb_interface_attr(product_string, s);
+gb_interface_attr(interface_id, "%u");
+gb_interface_attr(vendor_id, "0x%08x");
+gb_interface_attr(product_id, "0x%08x");
+gb_interface_attr(vendor_string, "%s");
+gb_interface_attr(product_string, "%s");
 
 static struct attribute *interface_attrs[] = {
        &dev_attr_interface_id.attr,