]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/ubi/build.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / mtd / ubi / build.c
index 535d9a8a6ba8374c6e8b064c5d74fd913009b846..9082768cc6c3850df4c9290e5f7487e795bc4e88 100644 (file)
@@ -159,8 +159,7 @@ void ubi_put_device(struct ubi_device *ubi)
 }
 
 /**
- * ubi_get_by_major - get UBI device description object by character device
- *                    major number.
+ * ubi_get_by_major - get UBI device by character device major number.
  * @major: major number
  *
  * This function is similar to 'ubi_get_device()', but it searches the device
@@ -281,7 +280,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
        ubi->dev.release = dev_release;
        ubi->dev.devt = ubi->cdev.dev;
        ubi->dev.class = ubi_class;
-       sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num);
+       dev_set_name(&ubi->dev, UBI_NAME_STR"%d", ubi->ubi_num);
        err = device_register(&ubi->dev);
        if (err)
                return err;
@@ -562,7 +561,7 @@ static int io_init(struct ubi_device *ubi)
         */
 
        ubi->peb_size   = ubi->mtd->erasesize;
-       ubi->peb_count  = ubi->mtd->size / ubi->mtd->erasesize;
+       ubi->peb_count  = mtd_div_by_eb(ubi->mtd->size, ubi->mtd);
        ubi->flash_size = ubi->mtd->size;
 
        if (ubi->mtd->block_isbad && ubi->mtd->block_markbad)
@@ -727,7 +726,7 @@ static int autoresize(struct ubi_device *ubi, int vol_id)
 
 /**
  * ubi_attach_mtd_dev - attach an MTD device.
- * @mtd_dev: MTD device description object
+ * @mtd: MTD device description object
  * @ubi_num: number to assign to the new UBI device
  * @vid_hdr_offset: VID header offset
  *
@@ -816,19 +815,20 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
        if (err)
                goto out_free;
 
+       err = -ENOMEM;
        ubi->peb_buf1 = vmalloc(ubi->peb_size);
        if (!ubi->peb_buf1)
                goto out_free;
 
        ubi->peb_buf2 = vmalloc(ubi->peb_size);
        if (!ubi->peb_buf2)
-                goto out_free;
+               goto out_free;
 
 #ifdef CONFIG_MTD_UBI_DEBUG
        mutex_init(&ubi->dbg_buf_mutex);
        ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
        if (!ubi->dbg_peb_buf)
-                goto out_free;
+               goto out_free;
 #endif
 
        err = attach_by_scanning(ubi);
@@ -871,11 +871,9 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
                ubi->beb_rsvd_pebs);
        ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec);
 
-       /* Enable the background thread */
-       if (!DBG_DISABLE_BGT) {
+       if (!DBG_DISABLE_BGT)
                ubi->thread_enabled = 1;
-               wake_up_process(ubi->bgt_thread);
-       }
+       wake_up_process(ubi->bgt_thread);
 
        ubi_devices[ubi_num] = ubi;
        return ubi_num;
@@ -1095,8 +1093,7 @@ static void __exit ubi_exit(void)
 module_exit(ubi_exit);
 
 /**
- * bytes_str_to_int - convert a string representing number of bytes to an
- * integer.
+ * bytes_str_to_int - convert a number of bytes string into an integer.
  * @str: the string to convert
  *
  * This function returns positive resulting integer in case of success and a