Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: wm831x: Use DEVICE_ATTR_RO macro

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes
the code a bit shorter and easier to read.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Zhen Lei and committed by
Lee Jones
981ce06a 3da286aa

+3 -3
+3 -3
drivers/mfd/wm831x-otp.c
··· 38 38 return 0; 39 39 } 40 40 41 - static ssize_t wm831x_unique_id_show(struct device *dev, 42 - struct device_attribute *attr, char *buf) 41 + static ssize_t unique_id_show(struct device *dev, 42 + struct device_attribute *attr, char *buf) 43 43 { 44 44 struct wm831x *wm831x = dev_get_drvdata(dev); 45 45 int rval; ··· 52 52 return sprintf(buf, "%*phN\n", WM831X_UNIQUE_ID_LEN, id); 53 53 } 54 54 55 - static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL); 55 + static DEVICE_ATTR_RO(unique_id); 56 56 57 57 int wm831x_otp_init(struct wm831x *wm831x) 58 58 {