projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
97f4100
)
mtd: core: add MTD_DEVICE_ATTR_RO/RW() helper macros
author
Zhen Lei
<thunder.leizhen@huawei.com>
Thu, 3 Jun 2021 12:53:22 +0000
(20:53 +0800)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Fri, 11 Jun 2021 18:42:50 +0000
(20:42 +0200)
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
drivers/mtd/mtdcore.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/mtdcore.c
b/drivers/mtd/mtdcore.c
index ce514305f8f756e6e763b3cde8f4f57e4d4726ef..770f64d6701567a29cb1da37d51685eb009e4d6f 100644
(file)
--- 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)
{