aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/block.c')
-rw-r--r--drivers/mtd/ubi/block.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 8876c7d3d712..6b6bce28bd63 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -111,13 +111,13 @@ static int __init ubiblock_set_param(const char *val,
111 111
112 len = strnlen(val, UBIBLOCK_PARAM_LEN); 112 len = strnlen(val, UBIBLOCK_PARAM_LEN);
113 if (len == 0) { 113 if (len == 0) {
114 ubi_warn("block: empty 'block=' parameter - ignored\n"); 114 pr_warn("UBI: block: empty 'block=' parameter - ignored\n");
115 return 0; 115 return 0;
116 } 116 }
117 117
118 if (len == UBIBLOCK_PARAM_LEN) { 118 if (len == UBIBLOCK_PARAM_LEN) {
119 ubi_err("block: parameter \"%s\" is too long, max. is %d\n", 119 pr_err("UBI: block: parameter \"%s\" is too long, max. is %d\n",
120 val, UBIBLOCK_PARAM_LEN); 120 val, UBIBLOCK_PARAM_LEN);
121 return -EINVAL; 121 return -EINVAL;
122 } 122 }
123 123
@@ -188,9 +188,8 @@ static int ubiblock_read_to_buf(struct ubiblock *dev, char *buffer,
188 188
189 ret = ubi_read(dev->desc, leb, buffer, offset, len); 189 ret = ubi_read(dev->desc, leb, buffer, offset, len);
190 if (ret) { 190 if (ret) {
191 ubi_err("%s: error %d while reading from LEB %d (offset %d, " 191 dev_err(disk_to_dev(dev->gd), "%d while reading from LEB %d (offset %d, length %d)",
192 "length %d)", dev->gd->disk_name, ret, leb, offset, 192 ret, leb, offset, len);
193 len);
194 return ret; 193 return ret;
195 } 194 }
196 return 0; 195 return 0;
@@ -328,8 +327,8 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
328 327
329 dev->desc = ubi_open_volume(dev->ubi_num, dev->vol_id, UBI_READONLY); 328 dev->desc = ubi_open_volume(dev->ubi_num, dev->vol_id, UBI_READONLY);
330 if (IS_ERR(dev->desc)) { 329 if (IS_ERR(dev->desc)) {
331 ubi_err("%s failed to open ubi volume %d_%d", 330 dev_err(disk_to_dev(dev->gd), "failed to open ubi volume %d_%d",
332 dev->gd->disk_name, dev->ubi_num, dev->vol_id); 331 dev->ubi_num, dev->vol_id);
333 ret = PTR_ERR(dev->desc); 332 ret = PTR_ERR(dev->desc);
334 dev->desc = NULL; 333 dev->desc = NULL;
335 goto out_unlock; 334 goto out_unlock;
@@ -405,7 +404,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
405 /* Initialize the gendisk of this ubiblock device */ 404 /* Initialize the gendisk of this ubiblock device */
406 gd = alloc_disk(1); 405 gd = alloc_disk(1);
407 if (!gd) { 406 if (!gd) {
408 ubi_err("block: alloc_disk failed"); 407 pr_err("UBI: block: alloc_disk failed");
409 ret = -ENODEV; 408 ret = -ENODEV;
410 goto out_free_dev; 409 goto out_free_dev;
411 } 410 }
@@ -421,7 +420,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
421 spin_lock_init(&dev->queue_lock); 420 spin_lock_init(&dev->queue_lock);
422 dev->rq = blk_init_queue(ubiblock_request, &dev->queue_lock); 421 dev->rq = blk_init_queue(ubiblock_request, &dev->queue_lock);
423 if (!dev->rq) { 422 if (!dev->rq) {
424 ubi_err("block: blk_init_queue failed"); 423 dev_err(disk_to_dev(gd), "blk_init_queue failed");
425 ret = -ENODEV; 424 ret = -ENODEV;
426 goto out_put_disk; 425 goto out_put_disk;
427 } 426 }
@@ -446,8 +445,8 @@ int ubiblock_create(struct ubi_volume_info *vi)
446 445
447 /* Must be the last step: anyone can call file ops from now on */ 446 /* Must be the last step: anyone can call file ops from now on */
448 add_disk(dev->gd); 447 add_disk(dev->gd);
449 ubi_msg("%s created from ubi%d:%d(%s)", 448 dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
450 dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name); 449 dev->ubi_num, dev->vol_id, vi->name);
451 return 0; 450 return 0;
452 451
453out_free_queue: 452out_free_queue:
@@ -464,7 +463,7 @@ static void ubiblock_cleanup(struct ubiblock *dev)
464{ 463{
465 del_gendisk(dev->gd); 464 del_gendisk(dev->gd);
466 blk_cleanup_queue(dev->rq); 465 blk_cleanup_queue(dev->rq);
467 ubi_msg("%s released", dev->gd->disk_name); 466 dev_info(disk_to_dev(dev->gd), "released");
468 put_disk(dev->gd); 467 put_disk(dev->gd);
469} 468}
470 469
@@ -518,8 +517,8 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
518 } 517 }
519 if ((sector_t)disk_capacity != disk_capacity) { 518 if ((sector_t)disk_capacity != disk_capacity) {
520 mutex_unlock(&devices_mutex); 519 mutex_unlock(&devices_mutex);
521 ubi_warn("%s: the volume is too big (%d LEBs), cannot resize", 520 dev_warn(disk_to_dev(dev->gd), "the volume is too big (%d LEBs), cannot resize",
522 dev->gd->disk_name, vi->size); 521 vi->size);
523 return -EFBIG; 522 return -EFBIG;
524 } 523 }
525 524
@@ -527,8 +526,8 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
527 526
528 if (get_capacity(dev->gd) != disk_capacity) { 527 if (get_capacity(dev->gd) != disk_capacity) {
529 set_capacity(dev->gd, disk_capacity); 528 set_capacity(dev->gd, disk_capacity);
530 ubi_msg("%s resized to %lld bytes", dev->gd->disk_name, 529 dev_info(disk_to_dev(dev->gd), "resized to %lld bytes",
531 vi->used_bytes); 530 vi->used_bytes);
532 } 531 }
533 mutex_unlock(&dev->dev_mutex); 532 mutex_unlock(&dev->dev_mutex);
534 mutex_unlock(&devices_mutex); 533 mutex_unlock(&devices_mutex);
@@ -596,8 +595,8 @@ static int __init ubiblock_create_from_param(void)
596 595
597 desc = open_volume_desc(p->name, p->ubi_num, p->vol_id); 596 desc = open_volume_desc(p->name, p->ubi_num, p->vol_id);
598 if (IS_ERR(desc)) { 597 if (IS_ERR(desc)) {
599 ubi_err("block: can't open volume, err=%ld\n", 598 pr_err("UBI: block: can't open volume, err=%ld\n",
600 PTR_ERR(desc)); 599 PTR_ERR(desc));
601 ret = PTR_ERR(desc); 600 ret = PTR_ERR(desc);
602 break; 601 break;
603 } 602 }
@@ -607,8 +606,8 @@ static int __init ubiblock_create_from_param(void)
607 606
608 ret = ubiblock_create(&vi); 607 ret = ubiblock_create(&vi);
609 if (ret) { 608 if (ret) {
610 ubi_err("block: can't add '%s' volume, err=%d\n", 609 pr_err("UBI: block: can't add '%s' volume, err=%d\n",
611 vi.name, ret); 610 vi.name, ret);
612 break; 611 break;
613 } 612 }
614 } 613 }