aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 76fe0a1e7a5e..65a7f3703881 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -19,6 +19,7 @@
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20 20
21#include <linux/mtd/mtd.h> 21#include <linux/mtd/mtd.h>
22#include "internal.h"
22 23
23#include "mtdcore.h" 24#include "mtdcore.h"
24 25
@@ -46,6 +47,20 @@ int add_mtd_device(struct mtd_info *mtd)
46{ 47{
47 int i; 48 int i;
48 49
50 if (!mtd->backing_dev_info) {
51 switch (mtd->type) {
52 case MTD_RAM:
53 mtd->backing_dev_info = &mtd_bdi_rw_mappable;
54 break;
55 case MTD_ROM:
56 mtd->backing_dev_info = &mtd_bdi_ro_mappable;
57 break;
58 default:
59 mtd->backing_dev_info = &mtd_bdi_unmappable;
60 break;
61 }
62 }
63
49 BUG_ON(mtd->writesize == 0); 64 BUG_ON(mtd->writesize == 0);
50 mutex_lock(&mtd_table_mutex); 65 mutex_lock(&mtd_table_mutex);
51 66