Merge tag 'char-misc-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
[platform/kernel/linux-starfive.git] / drivers / mtd / mtdcore.c
index fc60903..7731796 100644 (file)
@@ -336,49 +336,31 @@ static const struct device_type mtd_devtype = {
        .release        = mtd_release,
 };
 
-static int mtd_partid_debug_show(struct seq_file *s, void *p)
-{
-       struct mtd_info *mtd = s->private;
-
-       seq_printf(s, "%s\n", mtd->dbg.partid);
+static bool mtd_expert_analysis_mode;
 
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
-
-static int mtd_partname_debug_show(struct seq_file *s, void *p)
+#ifdef CONFIG_DEBUG_FS
+bool mtd_check_expert_analysis_mode(void)
 {
-       struct mtd_info *mtd = s->private;
-
-       seq_printf(s, "%s\n", mtd->dbg.partname);
+       const char *mtd_expert_analysis_warning =
+               "Bad block checks have been entirely disabled.\n"
+               "This is only reserved for post-mortem forensics and debug purposes.\n"
+               "Never enable this mode if you do not know what you are doing!\n";
 
-       return 0;
+       return WARN_ONCE(mtd_expert_analysis_mode, mtd_expert_analysis_warning);
 }
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
+EXPORT_SYMBOL_GPL(mtd_check_expert_analysis_mode);
+#endif
 
 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;
 
        if (IS_ERR_OR_NULL(dfs_dir_mtd))
                return;
 
-       root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
-       mtd->dbg.dfs_dir = root;
-
-       if (master->dbg.partid)
-               debugfs_create_file("partid", 0400, root, master,
-                                   &mtd_partid_debug_fops);
-
-       if (master->dbg.partname)
-               debugfs_create_file("partname", 0400, root, master,
-                                   &mtd_partname_debug_fops);
+       mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
 }
 
 #ifndef CONFIG_MMU
@@ -2367,14 +2349,6 @@ static struct backing_dev_info * __init mtd_bdi_init(const char *name)
        return ret ? ERR_PTR(ret) : bdi;
 }
 
-char *mtd_expert_analysis_warning =
-       "Bad block checks have been entirely disabled.\n"
-       "This is only reserved for post-mortem forensics and debug purposes.\n"
-       "Never enable this mode if you do not know what you are doing!\n";
-EXPORT_SYMBOL_GPL(mtd_expert_analysis_warning);
-bool mtd_expert_analysis_mode;
-EXPORT_SYMBOL_GPL(mtd_expert_analysis_mode);
-
 static struct proc_dir_entry *proc_mtd;
 
 static int __init init_mtd(void)