aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2021-06-03 20:30:41 +0800
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-06-11 20:42:45 +0200
commit97f41002945fd9c55e8b80c654ea34fd434250e7 (patch)
tree212f60f6921893082bede95228ed7fa7460a4c31
parentmtd: parsers: qcom: Fix leaking of partition name (diff)
downloadlinux-dev-97f41002945fd9c55e8b80c654ea34fd434250e7.tar.xz
linux-dev-97f41002945fd9c55e8b80c654ea34fd434250e7.zip
mtd: mtdpart: use DEVICE_ATTR_RO() helper macro
Use DEVICE_ATTR_RO() helper macro 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> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210603123041.12036-1-thunder.leizhen@huawei.com
-rw-r--r--drivers/mtd/mtdpart.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 66a67c6e3cbc..04af12b66110 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -212,15 +212,14 @@ out_register:
return child;
}
-static ssize_t mtd_partition_offset_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t offset_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct mtd_info *mtd = dev_get_drvdata(dev);
return sysfs_emit(buf, "%lld\n", mtd->part.offset);
}
-
-static DEVICE_ATTR(offset, S_IRUGO, mtd_partition_offset_show, NULL);
+static DEVICE_ATTR_RO(offset); /* mtd partition offset */
static const struct attribute *mtd_partition_attrs[] = {
&dev_attr_offset.attr,