aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 5ebe280225d6..a801ea6b8b6d 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -711,7 +711,7 @@ static int io_init(struct ubi_device *ubi)
711 } 711 }
712 712
713 /* Similar for the data offset */ 713 /* Similar for the data offset */
714 ubi->leb_start = ubi->vid_hdr_offset + UBI_EC_HDR_SIZE; 714 ubi->leb_start = ubi->vid_hdr_offset + UBI_VID_HDR_SIZE;
715 ubi->leb_start = ALIGN(ubi->leb_start, ubi->min_io_size); 715 ubi->leb_start = ALIGN(ubi->leb_start, ubi->min_io_size);
716 716
717 dbg_msg("vid_hdr_offset %d", ubi->vid_hdr_offset); 717 dbg_msg("vid_hdr_offset %d", ubi->vid_hdr_offset);
@@ -923,6 +923,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
923 spin_lock_init(&ubi->volumes_lock); 923 spin_lock_init(&ubi->volumes_lock);
924 924
925 ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); 925 ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num);
926 dbg_msg("sizeof(struct ubi_scan_leb) %zu", sizeof(struct ubi_scan_leb));
927 dbg_msg("sizeof(struct ubi_wl_entry) %zu", sizeof(struct ubi_wl_entry));
926 928
927 err = io_init(ubi); 929 err = io_init(ubi);
928 if (err) 930 if (err)
@@ -937,13 +939,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
937 if (!ubi->peb_buf2) 939 if (!ubi->peb_buf2)
938 goto out_free; 940 goto out_free;
939 941
940#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
941 mutex_init(&ubi->dbg_buf_mutex);
942 ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
943 if (!ubi->dbg_peb_buf)
944 goto out_free;
945#endif
946
947 err = attach_by_scanning(ubi); 942 err = attach_by_scanning(ubi);
948 if (err) { 943 if (err) {
949 dbg_err("failed to attach by scanning, error %d", err); 944 dbg_err("failed to attach by scanning, error %d", err);
@@ -991,8 +986,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
991 * checks @ubi->thread_enabled. Otherwise we may fail to wake it up. 986 * checks @ubi->thread_enabled. Otherwise we may fail to wake it up.
992 */ 987 */
993 spin_lock(&ubi->wl_lock); 988 spin_lock(&ubi->wl_lock);
994 if (!DBG_DISABLE_BGT) 989 ubi->thread_enabled = 1;
995 ubi->thread_enabled = 1;
996 wake_up_process(ubi->bgt_thread); 990 wake_up_process(ubi->bgt_thread);
997 spin_unlock(&ubi->wl_lock); 991 spin_unlock(&ubi->wl_lock);
998 992
@@ -1009,9 +1003,6 @@ out_detach:
1009out_free: 1003out_free:
1010 vfree(ubi->peb_buf1); 1004 vfree(ubi->peb_buf1);
1011 vfree(ubi->peb_buf2); 1005 vfree(ubi->peb_buf2);
1012#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
1013 vfree(ubi->dbg_peb_buf);
1014#endif
1015 if (ref) 1006 if (ref)
1016 put_device(&ubi->dev); 1007 put_device(&ubi->dev);
1017 else 1008 else
@@ -1082,9 +1073,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
1082 put_mtd_device(ubi->mtd); 1073 put_mtd_device(ubi->mtd);
1083 vfree(ubi->peb_buf1); 1074 vfree(ubi->peb_buf1);
1084 vfree(ubi->peb_buf2); 1075 vfree(ubi->peb_buf2);
1085#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
1086 vfree(ubi->dbg_peb_buf);
1087#endif
1088 ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num); 1076 ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
1089 put_device(&ubi->dev); 1077 put_device(&ubi->dev);
1090 return 0; 1078 return 0;