Skip to content

Commit

Permalink
mtd: Create partname and partid debug files for child MTDs
Browse files Browse the repository at this point in the history
Partname and partid are set by the upper driver (spi-nor) on the master
MTD. If this MTD is partitioned and CONFIG_MTD_PARTITIONED_MASTER is
disabled, the master MTD is not instantiated and partname and partid
aren't available to the userspace.

Always read the partname and partid from the master MTD, they describe
the HW, which can't differ between master and its children.

Signed-off-by: Petr Malat <oss@malat.biz>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210430065057.32018-1-oss@malat.biz
  • Loading branch information
Petr Malat authored and Miquel Raynal committed May 10, 2021
1 parent 063deb3 commit feb05fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ static struct dentry *dfs_dir_mtd;

static void mtd_debugfs_populate(struct mtd_info *mtd)
{
struct mtd_info *master = mtd_get_master(mtd);
struct device *dev = &mtd->dev;
struct dentry *root;

Expand All @@ -369,12 +370,12 @@ static void mtd_debugfs_populate(struct mtd_info *mtd)
root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
mtd->dbg.dfs_dir = root;

if (mtd->dbg.partid)
debugfs_create_file("partid", 0400, root, mtd,
if (master->dbg.partid)
debugfs_create_file("partid", 0400, root, master,
&mtd_partid_debug_fops);

if (mtd->dbg.partname)
debugfs_create_file("partname", 0400, root, mtd,
if (master->dbg.partname)
debugfs_create_file("partname", 0400, root, master,
&mtd_partname_debug_fops);
}

Expand Down

0 comments on commit feb05fa

Please sign in to comment.