diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-11-12 03:14:10 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-12-03 06:24:48 -0500 |
commit | ed45819f315b5a8844b5bfce881a18e9f3a055e7 (patch) | |
tree | dc843958848ed8126ec17e35c5d784f5ef4b6702 /drivers | |
parent | f6f7b52e2f6149d2ee365717afff315b05720162 (diff) |
UBI: fix warnings when debugging is enabled
The 'ubi_io_read_vid_hdr()' and 'ubi_io_read_ec_hdr()' function
have the 'verbose' argument which controls whether they should
print a warning if the VID/EC header was not found or was corrupted.
Some callers require the headers to be OK, and pass 1. Some allow
a corrupted/not present header, and pass 0.
if (UBI_IO_DEBUG)
verbose = 1;
And UBI_IO_DEBUG is 1 if CONFIG_MTD_UBI_DEBUG_MSG_BLD is true. So in
this case the warning is printed all the time. This confuses people.
Thus, do not print the messages as warnings if UBI_IO_DEBUG is true,
but print them as debugging messages instead.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/ubi/io.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 2fb64be44f1b..f60f700256f6 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -637,8 +637,6 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
637 | 637 | ||
638 | dbg_io("read EC header from PEB %d", pnum); | 638 | dbg_io("read EC header from PEB %d", pnum); |
639 | ubi_assert(pnum >= 0 && pnum < ubi->peb_count); | 639 | ubi_assert(pnum >= 0 && pnum < ubi->peb_count); |
640 | if (UBI_IO_DEBUG) | ||
641 | verbose = 1; | ||
642 | 640 | ||
643 | err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE); | 641 | err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE); |
644 | if (err) { | 642 | if (err) { |
@@ -685,6 +683,9 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
685 | if (verbose) | 683 | if (verbose) |
686 | ubi_warn("no EC header found at PEB %d, " | 684 | ubi_warn("no EC header found at PEB %d, " |
687 | "only 0xFF bytes", pnum); | 685 | "only 0xFF bytes", pnum); |
686 | else if (UBI_IO_DEBUG) | ||
687 | dbg_msg("no EC header found at PEB %d, " | ||
688 | "only 0xFF bytes", pnum); | ||
688 | return UBI_IO_PEB_EMPTY; | 689 | return UBI_IO_PEB_EMPTY; |
689 | } | 690 | } |
690 | 691 | ||
@@ -696,7 +697,9 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
696 | ubi_warn("bad magic number at PEB %d: %08x instead of " | 697 | ubi_warn("bad magic number at PEB %d: %08x instead of " |
697 | "%08x", pnum, magic, UBI_EC_HDR_MAGIC); | 698 | "%08x", pnum, magic, UBI_EC_HDR_MAGIC); |
698 | ubi_dbg_dump_ec_hdr(ec_hdr); | 699 | ubi_dbg_dump_ec_hdr(ec_hdr); |
699 | } | 700 | } else if (UBI_IO_DEBUG) |
701 | dbg_msg("bad magic number at PEB %d: %08x instead of " | ||
702 | "%08x", pnum, magic, UBI_EC_HDR_MAGIC); | ||
700 | return UBI_IO_BAD_EC_HDR; | 703 | return UBI_IO_BAD_EC_HDR; |
701 | } | 704 | } |
702 | 705 | ||
@@ -708,7 +711,9 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
708 | ubi_warn("bad EC header CRC at PEB %d, calculated " | 711 | ubi_warn("bad EC header CRC at PEB %d, calculated " |
709 | "%#08x, read %#08x", pnum, crc, hdr_crc); | 712 | "%#08x, read %#08x", pnum, crc, hdr_crc); |
710 | ubi_dbg_dump_ec_hdr(ec_hdr); | 713 | ubi_dbg_dump_ec_hdr(ec_hdr); |
711 | } | 714 | } else if (UBI_IO_DEBUG) |
715 | dbg_msg("bad EC header CRC at PEB %d, calculated " | ||
716 | "%#08x, read %#08x", pnum, crc, hdr_crc); | ||
712 | return UBI_IO_BAD_EC_HDR; | 717 | return UBI_IO_BAD_EC_HDR; |
713 | } | 718 | } |
714 | 719 | ||
@@ -912,8 +917,6 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
912 | 917 | ||
913 | dbg_io("read VID header from PEB %d", pnum); | 918 | dbg_io("read VID header from PEB %d", pnum); |
914 | ubi_assert(pnum >= 0 && pnum < ubi->peb_count); | 919 | ubi_assert(pnum >= 0 && pnum < ubi->peb_count); |
915 | if (UBI_IO_DEBUG) | ||
916 | verbose = 1; | ||
917 | 920 | ||
918 | p = (char *)vid_hdr - ubi->vid_hdr_shift; | 921 | p = (char *)vid_hdr - ubi->vid_hdr_shift; |
919 | err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, | 922 | err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, |
@@ -960,6 +963,9 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
960 | if (verbose) | 963 | if (verbose) |
961 | ubi_warn("no VID header found at PEB %d, " | 964 | ubi_warn("no VID header found at PEB %d, " |
962 | "only 0xFF bytes", pnum); | 965 | "only 0xFF bytes", pnum); |
966 | else if (UBI_IO_DEBUG) | ||
967 | dbg_msg("no VID header found at PEB %d, " | ||
968 | "only 0xFF bytes", pnum); | ||
963 | return UBI_IO_PEB_FREE; | 969 | return UBI_IO_PEB_FREE; |
964 | } | 970 | } |
965 | 971 | ||
@@ -971,7 +977,9 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
971 | ubi_warn("bad magic number at PEB %d: %08x instead of " | 977 | ubi_warn("bad magic number at PEB %d: %08x instead of " |
972 | "%08x", pnum, magic, UBI_VID_HDR_MAGIC); | 978 | "%08x", pnum, magic, UBI_VID_HDR_MAGIC); |
973 | ubi_dbg_dump_vid_hdr(vid_hdr); | 979 | ubi_dbg_dump_vid_hdr(vid_hdr); |
974 | } | 980 | } else if (UBI_IO_DEBUG) |
981 | dbg_msg("bad magic number at PEB %d: %08x instead of " | ||
982 | "%08x", pnum, magic, UBI_VID_HDR_MAGIC); | ||
975 | return UBI_IO_BAD_VID_HDR; | 983 | return UBI_IO_BAD_VID_HDR; |
976 | } | 984 | } |
977 | 985 | ||
@@ -983,7 +991,9 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
983 | ubi_warn("bad CRC at PEB %d, calculated %#08x, " | 991 | ubi_warn("bad CRC at PEB %d, calculated %#08x, " |
984 | "read %#08x", pnum, crc, hdr_crc); | 992 | "read %#08x", pnum, crc, hdr_crc); |
985 | ubi_dbg_dump_vid_hdr(vid_hdr); | 993 | ubi_dbg_dump_vid_hdr(vid_hdr); |
986 | } | 994 | } else if (UBI_IO_DEBUG) |
995 | dbg_msg("bad CRC at PEB %d, calculated %#08x, " | ||
996 | "read %#08x", pnum, crc, hdr_crc); | ||
987 | return UBI_IO_BAD_VID_HDR; | 997 | return UBI_IO_BAD_VID_HDR; |
988 | } | 998 | } |
989 | 999 | ||