From: Viresh Kumar Date: Fri, 18 Dec 2015 09:34:27 +0000 (+0530) Subject: greybus: interface: Prefix hexadecimal values with '0x' X-Git-Tag: v4.9.8~1233^2~378^2~21^2~903 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c7df74468506f390cd53c0af3457943e8076bd8;p=platform%2Fkernel%2Flinux-rpi3.git greybus: interface: Prefix hexadecimal values with '0x' 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 Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index ecc64be..c43992d 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -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,