UBI: Extend UBI layer debug/messaging capabilities
[linux-2.6-microblaze.git] / drivers / mtd / ubi / block.c
index 8876c7d..6b6bce2 100644 (file)
@@ -111,13 +111,13 @@ static int __init ubiblock_set_param(const char *val,
 
        len = strnlen(val, UBIBLOCK_PARAM_LEN);
        if (len == 0) {
-               ubi_warn("block: empty 'block=' parameter - ignored\n");
+               pr_warn("UBI: block: empty 'block=' parameter - ignored\n");
                return 0;
        }
 
        if (len == UBIBLOCK_PARAM_LEN) {
-               ubi_err("block: parameter \"%s\" is too long, max. is %d\n",
-                       val, UBIBLOCK_PARAM_LEN);
+               pr_err("UBI: block: parameter \"%s\" is too long, max. is %d\n",
+                      val, UBIBLOCK_PARAM_LEN);
                return -EINVAL;
        }
 
@@ -188,9 +188,8 @@ static int ubiblock_read_to_buf(struct ubiblock *dev, char *buffer,
 
        ret = ubi_read(dev->desc, leb, buffer, offset, len);
        if (ret) {
-               ubi_err("%s: error %d while reading from LEB %d (offset %d, "
-                       "length %d)", dev->gd->disk_name, ret, leb, offset,
-                       len);
+               dev_err(disk_to_dev(dev->gd), "%d while reading from LEB %d (offset %d, length %d)",
+                       ret, leb, offset, len);
                return ret;
        }
        return 0;
@@ -328,8 +327,8 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
 
        dev->desc = ubi_open_volume(dev->ubi_num, dev->vol_id, UBI_READONLY);
        if (IS_ERR(dev->desc)) {
-               ubi_err("%s failed to open ubi volume %d_%d",
-                       dev->gd->disk_name, dev->ubi_num, dev->vol_id);
+               dev_err(disk_to_dev(dev->gd), "failed to open ubi volume %d_%d",
+                       dev->ubi_num, dev->vol_id);
                ret = PTR_ERR(dev->desc);
                dev->desc = NULL;
                goto out_unlock;
@@ -405,7 +404,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
        /* Initialize the gendisk of this ubiblock device */
        gd = alloc_disk(1);
        if (!gd) {
-               ubi_err("block: alloc_disk failed");
+               pr_err("UBI: block: alloc_disk failed");
                ret = -ENODEV;
                goto out_free_dev;
        }
@@ -421,7 +420,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
        spin_lock_init(&dev->queue_lock);
        dev->rq = blk_init_queue(ubiblock_request, &dev->queue_lock);
        if (!dev->rq) {
-               ubi_err("block: blk_init_queue failed");
+               dev_err(disk_to_dev(gd), "blk_init_queue failed");
                ret = -ENODEV;
                goto out_put_disk;
        }
@@ -446,8 +445,8 @@ int ubiblock_create(struct ubi_volume_info *vi)
 
        /* Must be the last step: anyone can call file ops from now on */
        add_disk(dev->gd);
-       ubi_msg("%s created from ubi%d:%d(%s)",
-               dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name);
+       dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
+                dev->ubi_num, dev->vol_id, vi->name);
        return 0;
 
 out_free_queue:
@@ -464,7 +463,7 @@ static void ubiblock_cleanup(struct ubiblock *dev)
 {
        del_gendisk(dev->gd);
        blk_cleanup_queue(dev->rq);
-       ubi_msg("%s released", dev->gd->disk_name);
+       dev_info(disk_to_dev(dev->gd), "released");
        put_disk(dev->gd);
 }
 
@@ -518,8 +517,8 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
        }
        if ((sector_t)disk_capacity != disk_capacity) {
                mutex_unlock(&devices_mutex);
-               ubi_warn("%s: the volume is too big (%d LEBs), cannot resize",
-                        dev->gd->disk_name, vi->size);
+               dev_warn(disk_to_dev(dev->gd), "the volume is too big (%d LEBs), cannot resize",
+                        vi->size);
                return -EFBIG;
        }
 
@@ -527,8 +526,8 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
 
        if (get_capacity(dev->gd) != disk_capacity) {
                set_capacity(dev->gd, disk_capacity);
-               ubi_msg("%s resized to %lld bytes", dev->gd->disk_name,
-                       vi->used_bytes);
+               dev_info(disk_to_dev(dev->gd), "resized to %lld bytes",
+                        vi->used_bytes);
        }
        mutex_unlock(&dev->dev_mutex);
        mutex_unlock(&devices_mutex);
@@ -596,8 +595,8 @@ static int __init ubiblock_create_from_param(void)
 
                desc = open_volume_desc(p->name, p->ubi_num, p->vol_id);
                if (IS_ERR(desc)) {
-                       ubi_err("block: can't open volume, err=%ld\n",
-                               PTR_ERR(desc));
+                       pr_err("UBI: block: can't open volume, err=%ld\n",
+                              PTR_ERR(desc));
                        ret = PTR_ERR(desc);
                        break;
                }
@@ -607,8 +606,8 @@ static int __init ubiblock_create_from_param(void)
 
                ret = ubiblock_create(&vi);
                if (ret) {
-                       ubi_err("block: can't add '%s' volume, err=%d\n",
-                               vi.name, ret);
+                       pr_err("UBI: block: can't add '%s' volume, err=%d\n",
+                              vi.name, ret);
                        break;
                }
        }