未验证 提交 dcc935b0 编写于 作者: Z Zhuohao Lee 提交者: Tudor Ambarus

mtd: spi-nor: enable the debugfs for the partname and partid

This patch adds spi_nor_debugfs_init() for the debugfs initialization.
With this patch, we can read the partname and partid through the
debugfs.

The output of new debugfs nodes on my device are:
cat /sys/kernel/debug/mtd/mtd0/partid
spi-nor:ef6017
cat /sys/kernel/debug/mtd/mtd0/partname
w25q64dw
Signed-off-by: NZhuohao Lee <zhuohao@chromium.org>
Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com>
上级 1018c94b
......@@ -4767,6 +4767,16 @@ static int spi_nor_set_addr_width(struct spi_nor *nor)
return 0;
}
static void spi_nor_debugfs_init(struct spi_nor *nor,
const struct flash_info *info)
{
struct mtd_info *mtd = &nor->mtd;
mtd->dbg.partname = info->name;
mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, "spi-nor:%*phN",
info->id_len, info->id);
}
static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
const char *name)
{
......@@ -4847,6 +4857,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
nor->info = info;
spi_nor_debugfs_init(nor, info);
mutex_init(&nor->lock);
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册