aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2021-06-03 20:53:22 +0800
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-06-11 20:42:50 +0200
commitb4e248632c968d985f0ecfd7924423fbefc39d1c (patch)
treea0d13b7179dbe0aedc7788327b4e937cb9fb2b70 /drivers/mtd
parentmtd: mtdpart: use DEVICE_ATTR_RO() helper macro (diff)
downloadlinux-dev-b4e248632c968d985f0ecfd7924423fbefc39d1c.tar.xz
linux-dev-b4e248632c968d985f0ecfd7924423fbefc39d1c.zip
mtd: core: add MTD_DEVICE_ATTR_RO/RW() helper macros
Compared with the definition of DEVICE_ATTR_RO/RW(), the read and write function names of the sysfs attribute have an additional "mtd_" prefix. 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/20210603125323.12142-2-thunder.leizhen@huawei.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdcore.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index ce514305f8f7..770f64d67015 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -96,6 +96,12 @@ static void mtd_release(struct device *dev)
device_destroy(&mtd_class, index + 1);
}
+#define MTD_DEVICE_ATTR_RO(name) \
+static DEVICE_ATTR(name, 0444, mtd_##name##_show, NULL)
+
+#define MTD_DEVICE_ATTR_RW(name) \
+static DEVICE_ATTR(name, 0644, mtd_##name##_show, mtd_##name##_store)
+
static ssize_t mtd_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{