Skip to content

Commit

Permalink
mtd: core: add MTD_DEVICE_ATTR_RO/RW() helper macros
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Zhen Lei authored and Miquel Raynal committed Jun 11, 2021
1 parent 97f4100 commit b4e2486
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit b4e2486

Please sign in to comment.