Merge tag 'nand/for-4.21' of git://git.infradead.org/linux-mtd into mtd/next
[linux-2.6-microblaze.git] / drivers / mtd / nand / raw / nandsim.c
index 2b3047d..933d1a6 100644 (file)
@@ -443,7 +443,7 @@ static unsigned long total_wear = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static int nandsim_debugfs_show(struct seq_file *m, void *private)
+static int nandsim_show(struct seq_file *m, void *private)
 {
        unsigned long wmin = -1, wmax = 0, avg;
        unsigned long deciles[10], decile_max[10], tot = 0;
@@ -494,18 +494,7 @@ static int nandsim_debugfs_show(struct seq_file *m, void *private)
 
        return 0;
 }
-
-static int nandsim_debugfs_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, nandsim_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations dfs_fops = {
-       .open           = nandsim_debugfs_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(nandsim);
 
 /**
  * nandsim_debugfs_create - initialize debugfs
@@ -531,7 +520,7 @@ static int nandsim_debugfs_create(struct nandsim *dev)
        }
 
        dent = debugfs_create_file("nandsim_wear_report", S_IRUSR,
-                                  root, dev, &dfs_fops);
+                                  root, dev, &nandsim_fops);
        if (IS_ERR_OR_NULL(dent)) {
                NS_ERR("cannot create \"nandsim_wear_report\" debugfs entry\n");
                return -1;