summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/wm831x-otp.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/mfd/wm831x-otp.c b/drivers/mfd/wm831x-otp.c
index b90f3e06b6c9..ebac0027f8e0 100644
--- a/drivers/mfd/wm831x-otp.c
+++ b/drivers/mfd/wm831x-otp.c
@@ -47,20 +47,14 @@ static ssize_t wm831x_unique_id_show(struct device *dev,
47 struct device_attribute *attr, char *buf) 47 struct device_attribute *attr, char *buf)
48{ 48{
49 struct wm831x *wm831x = dev_get_drvdata(dev); 49 struct wm831x *wm831x = dev_get_drvdata(dev);
50 int i, rval; 50 int rval;
51 char id[WM831X_UNIQUE_ID_LEN]; 51 char id[WM831X_UNIQUE_ID_LEN];
52 ssize_t ret = 0;
53 52
54 rval = wm831x_unique_id_read(wm831x, id); 53 rval = wm831x_unique_id_read(wm831x, id);
55 if (rval < 0) 54 if (rval < 0)
56 return 0; 55 return 0;
57 56
58 for (i = 0; i < WM831X_UNIQUE_ID_LEN; i++) 57 return sprintf(buf, "%*phN\n", WM831X_UNIQUE_ID_LEN, id);
59 ret += sprintf(&buf[ret], "%02x", buf[i]);
60
61 ret += sprintf(&buf[ret], "\n");
62
63 return ret;
64} 58}
65 59
66static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL); 60static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL);