aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTanya Brokhman <tlinder@codeaurora.org>2014-11-09 06:06:25 -0500
committerRichard Weinberger <richard@nod.at>2015-01-28 10:09:09 -0500
commit45fc5c81d03601da36e8217e9830d053ef2d7db6 (patch)
tree24b9ed617aa7984b302a1badc7da55b8f97eadc5
parentfee1756d80c24d5a3171cb9f76d612e512439dd2 (diff)
UBI: extend UBI layer debug/messaging capabilities - cosmetics
Some cosmetic fixes to the patch "UBI: Extend UBI layer debug/messaging capabilities". Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--drivers/mtd/ubi/build.c6
-rw-r--r--drivers/mtd/ubi/cdev.c9
-rw-r--r--drivers/mtd/ubi/io.c3
-rw-r--r--drivers/mtd/ubi/vtbl.c7
-rw-r--r--drivers/mtd/ubi/wl.c10
5 files changed, 13 insertions, 22 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 3405be46ebe9..ba01a8d22d28 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -923,7 +923,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
923 923
924 /* Make sure ubi_num is not busy */ 924 /* Make sure ubi_num is not busy */
925 if (ubi_devices[ubi_num]) { 925 if (ubi_devices[ubi_num]) {
926 ubi_err(ubi, "ubi%d already exists", ubi_num); 926 ubi_err(ubi, "already exists");
927 return -EEXIST; 927 return -EEXIST;
928 } 928 }
929 } 929 }
@@ -973,7 +973,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
973 mutex_init(&ubi->fm_mutex); 973 mutex_init(&ubi->fm_mutex);
974 init_rwsem(&ubi->fm_sem); 974 init_rwsem(&ubi->fm_sem);
975 975
976 ubi_msg(ubi, "attaching mtd%d to ubi%d", mtd->index, ubi_num); 976 ubi_msg(ubi, "attaching mtd%d", mtd->index);
977 977
978 err = io_init(ubi, max_beb_per1024); 978 err = io_init(ubi, max_beb_per1024);
979 if (err) 979 if (err)
@@ -1428,7 +1428,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
1428 } 1428 }
1429 1429
1430 if (len == 0) { 1430 if (len == 0) {
1431 pr_err("UBI warning: empty 'mtd=' parameter - ignored\n"); 1431 pr_warn("UBI warning: empty 'mtd=' parameter - ignored\n");
1432 return 0; 1432 return 0;
1433 } 1433 }
1434 1434
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 286383c11126..d647e504f9b1 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -48,14 +48,13 @@
48 48
49/** 49/**
50 * get_exclusive - get exclusive access to an UBI volume. 50 * get_exclusive - get exclusive access to an UBI volume.
51 * @ubi: UBI device description object
52 * @desc: volume descriptor 51 * @desc: volume descriptor
53 * 52 *
54 * This function changes UBI volume open mode to "exclusive". Returns previous 53 * This function changes UBI volume open mode to "exclusive". Returns previous
55 * mode value (positive integer) in case of success and a negative error code 54 * mode value (positive integer) in case of success and a negative error code
56 * in case of failure. 55 * in case of failure.
57 */ 56 */
58static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc) 57static int get_exclusive(struct ubi_volume_desc *desc)
59{ 58{
60 int users, err; 59 int users, err;
61 struct ubi_volume *vol = desc->vol; 60 struct ubi_volume *vol = desc->vol;
@@ -64,7 +63,7 @@ static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc)
64 users = vol->readers + vol->writers + vol->exclusive + vol->metaonly; 63 users = vol->readers + vol->writers + vol->exclusive + vol->metaonly;
65 ubi_assert(users > 0); 64 ubi_assert(users > 0);
66 if (users > 1) { 65 if (users > 1) {
67 ubi_err(ubi, "%d users for volume %d", users, vol->vol_id); 66 ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id);
68 err = -EBUSY; 67 err = -EBUSY;
69 } else { 68 } else {
70 vol->readers = vol->writers = vol->metaonly = 0; 69 vol->readers = vol->writers = vol->metaonly = 0;
@@ -423,7 +422,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
423 break; 422 break;
424 } 423 }
425 424
426 err = get_exclusive(ubi, desc); 425 err = get_exclusive(desc);
427 if (err < 0) 426 if (err < 0)
428 break; 427 break;
429 428
@@ -459,7 +458,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
459 req.bytes < 0 || req.lnum >= vol->usable_leb_size) 458 req.bytes < 0 || req.lnum >= vol->usable_leb_size)
460 break; 459 break;
461 460
462 err = get_exclusive(ubi, desc); 461 err = get_exclusive(desc);
463 if (err < 0) 462 if (err < 0)
464 break; 463 break;
465 464
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 396aaa543362..ed0bcb35472f 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1419,8 +1419,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
1419 1419
1420fail: 1420fail:
1421 ubi_err(ubi, "self-check failed for PEB %d", pnum); 1421 ubi_err(ubi, "self-check failed for PEB %d", pnum);
1422 ubi_msg(ubi, "hex dump of the %d-%d region", 1422 ubi_msg(ubi, "hex dump of the %d-%d region", offset, offset + len);
1423 offset, offset + len);
1424 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1); 1423 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1);
1425 err = -EINVAL; 1424 err = -EINVAL;
1426error: 1425error:
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index f8fc3081bbb4..68c9c5ea676f 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -655,14 +655,13 @@ static int init_volumes(struct ubi_device *ubi,
655 655
656/** 656/**
657 * check_av - check volume attaching information. 657 * check_av - check volume attaching information.
658 * @ubi: UBI device description object
659 * @vol: UBI volume description object 658 * @vol: UBI volume description object
660 * @av: volume attaching information 659 * @av: volume attaching information
661 * 660 *
662 * This function returns zero if the volume attaching information is consistent 661 * This function returns zero if the volume attaching information is consistent
663 * to the data read from the volume tabla, and %-EINVAL if not. 662 * to the data read from the volume tabla, and %-EINVAL if not.
664 */ 663 */
665static int check_av(const struct ubi_device *ubi, const struct ubi_volume *vol, 664static int check_av(const struct ubi_volume *vol,
666 const struct ubi_ainf_volume *av) 665 const struct ubi_ainf_volume *av)
667{ 666{
668 int err; 667 int err;
@@ -690,7 +689,7 @@ static int check_av(const struct ubi_device *ubi, const struct ubi_volume *vol,
690 return 0; 689 return 0;
691 690
692bad: 691bad:
693 ubi_err(ubi, "bad attaching information, error %d", err); 692 ubi_err(vol->ubi, "bad attaching information, error %d", err);
694 ubi_dump_av(av); 693 ubi_dump_av(av);
695 ubi_dump_vol_info(vol); 694 ubi_dump_vol_info(vol);
696 return -EINVAL; 695 return -EINVAL;
@@ -753,7 +752,7 @@ static int check_attaching_info(const struct ubi_device *ubi,
753 ubi_msg(ubi, "finish volume %d removal", av->vol_id); 752 ubi_msg(ubi, "finish volume %d removal", av->vol_id);
754 ubi_remove_av(ai, av); 753 ubi_remove_av(ai, av);
755 } else if (av) { 754 } else if (av) {
756 err = check_av(ubi, vol, av); 755 err = check_av(vol, av);
757 if (err) 756 if (err)
758 return err; 757 return err;
759 } 758 }
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 834f6fe1f5fa..8f7bde6a85d6 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -470,11 +470,8 @@ struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor)
470{ 470{
471 struct ubi_wl_entry *e = NULL; 471 struct ubi_wl_entry *e = NULL;
472 472
473 if (!ubi->free.rb_node || (ubi->free_count - ubi->beb_rsvd_pebs < 1)) { 473 if (!ubi->free.rb_node || (ubi->free_count - ubi->beb_rsvd_pebs < 1))
474 ubi_warn(ubi, "Can't get peb for fastmap:anchor=%d, free_cnt=%d, reserved=%d",
475 anchor, ubi->free_count, ubi->beb_rsvd_pebs);
476 goto out; 474 goto out;
477 }
478 475
479 if (anchor) 476 if (anchor)
480 e = find_anchor_wl_entry(&ubi->free); 477 e = find_anchor_wl_entry(&ubi->free);
@@ -1806,11 +1803,8 @@ int ubi_thread(void *u)
1806 for (;;) { 1803 for (;;) {
1807 int err; 1804 int err;
1808 1805
1809 if (kthread_should_stop()) { 1806 if (kthread_should_stop())
1810 ubi_msg(ubi, "background thread \"%s\" should stop, PID %d",
1811 ubi->bgt_name, task_pid_nr(current));
1812 break; 1807 break;
1813 }
1814 1808
1815 if (try_to_freeze()) 1809 if (try_to_freeze())
1816 continue; 1810 continue;