diff --git a/arch/arm/configs/mdm9607-perf_defconfig b/arch/arm/configs/mdm9607-perf_defconfig index f8ab7df7c..0ea03aafb 100644 --- a/arch/arm/configs/mdm9607-perf_defconfig +++ b/arch/arm/configs/mdm9607-perf_defconfig @@ -1083,7 +1083,8 @@ CONFIG_MTD_NAND_IDS=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set +CONFIG_MTD_UBI_FASTMAP=y +CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1 # CONFIG_MTD_UBI_GLUEBI is not set # CONFIG_MTD_UBI_BLOCK is not set CONFIG_DTC=y diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig index f0855ce08..a34c39b2c 100644 --- a/drivers/mtd/ubi/Kconfig +++ b/drivers/mtd/ubi/Kconfig @@ -77,6 +77,21 @@ config MTD_UBI_FASTMAP If in doubt, say "N". +config MTD_UBI_FASTMAP_AUTOCONVERT + int "enable UBI Fastmap autoconvert" + depends on MTD_UBI_FASTMAP + default 0 + help + Set this parameter to enable fastmap automatically on images + without a fastmap. + +config MTD_UBI_FM_DEBUG + int "Enable UBI fastmap debug" + depends on MTD_UBI_FASTMAP + default 0 + help + Enable UBI fastmap debug + config MTD_UBI_GLUEBI tristate "MTD devices emulation driver (gluebi)" help diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index fcafdd722..661edea5a 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -80,8 +80,14 @@ static int __initdata mtd_devs; static struct mtd_dev_param __initdata mtd_dev_param[UBI_MAX_DEVICES]; #ifdef CONFIG_MTD_UBI_FASTMAP /* UBI module parameter to enable fastmap automatically on non-fastmap images */ -static bool fm_autoconvert; -static bool fm_debug; +#if !defined(CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT) +#define CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT 0 +#endif +static bool fm_autoconvert = CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT; +#if !defined(CONFIG_MTD_UBI_FM_DEBUG) +#define CONFIG_MTD_UBI_FM_DEBUG 0 +#endif +static bool fm_debug = CONFIG_MTD_UBI_FM_DEBUG; #endif /* Slab cache for wear-leveling entries */ diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 9c763e14e..0f2601027 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -369,7 +369,7 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, * Returns 0 on success, negative error code in case of failure. */ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, - int *pnum) + int pnum) { int err; struct ubi_vid_hdr *vid_hdr; @@ -381,7 +381,7 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu if (!vid_hdr) return -ENOMEM; - err = ubi_io_read_vid_hdr(ubi, *pnum, vid_hdr, 0); + err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 0); if (err > 0 && err != UBI_IO_BITFLIPS) { int torture = 0; @@ -398,15 +398,15 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_FF_BITFLIPS) torture = 1; - down_read(&ubi->fm_sem); + down_read(&ubi->fm_eba_sem); vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED; - up_read(&ubi->fm_sem); - ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture); + up_read(&ubi->fm_eba_sem); + ubi_wl_put_peb(ubi, vol->vol_id, lnum, pnum, torture); - *pnum = UBI_LEB_UNMAPPED; + pnum = UBI_LEB_UNMAPPED; } else if (err < 0) { - ubi_err("unable to read VID header back from PEB %i: %i", - *pnum, err); + ubi_err(ubi, "unable to read VID header back from PEB %i: %i", + pnum, err); goto out_free; } @@ -420,7 +420,7 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu } #else static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, - int *pnum) + int pnum) { return 0; }