aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-18 05:54:58 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-20 14:01:28 -0400
commit9c47fb2fbe585698e9e6dac3ec033ea94765f38c (patch)
tree327baaa9b48e190a03a829039cac21714a0d02b9 /drivers/mtd/ubi
parent47e1ec70b2c57f39752ae3210d89a625768f3e12 (diff)
UBI: rename UBI_SCAN_UNKNOWN_EC
Rename the constant to UBI_UNKNOWN, for the same reason that we are going to add nother attaching method and re-use the same data structures, so the "SCAN" in the name becomes incorrect. I've also removed the "_EC" part because Joel is going to use this constant for other fields in the attaching info data structures. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/scan.c18
-rw-r--r--drivers/mtd/ubi/scan.h9
2 files changed, 15 insertions, 12 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index aecd8cfa3f47..f59f748caf23 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -644,7 +644,7 @@ void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av)
644 * @ubi: UBI device description object 644 * @ubi: UBI device description object
645 * @ai: attaching information 645 * @ai: attaching information
646 * @pnum: physical eraseblock number to erase; 646 * @pnum: physical eraseblock number to erase;
647 * @ec: erase counter value to write (%UBI_SCAN_UNKNOWN_EC if it is unknown) 647 * @ec: erase counter value to write (%UBI_UNKNOWN if it is unknown)
648 * 648 *
649 * This function erases physical eraseblock 'pnum', and writes the erase 649 * This function erases physical eraseblock 'pnum', and writes the erase
650 * counter header to it. This function should only be used on UBI device 650 * counter header to it. This function should only be used on UBI device
@@ -718,7 +718,7 @@ struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi,
718 * they'll be handled later. 718 * they'll be handled later.
719 */ 719 */
720 list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) { 720 list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) {
721 if (aeb->ec == UBI_SCAN_UNKNOWN_EC) 721 if (aeb->ec == UBI_UNKNOWN)
722 aeb->ec = ai->mean_ec; 722 aeb->ec = ai->mean_ec;
723 723
724 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); 724 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1);
@@ -834,11 +834,11 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
834 break; 834 break;
835 case UBI_IO_FF: 835 case UBI_IO_FF:
836 ai->empty_peb_count += 1; 836 ai->empty_peb_count += 1;
837 return add_to_list(ai, pnum, UBI_SCAN_UNKNOWN_EC, 0, 837 return add_to_list(ai, pnum, UBI_UNKNOWN, 0,
838 &ai->erase); 838 &ai->erase);
839 case UBI_IO_FF_BITFLIPS: 839 case UBI_IO_FF_BITFLIPS:
840 ai->empty_peb_count += 1; 840 ai->empty_peb_count += 1;
841 return add_to_list(ai, pnum, UBI_SCAN_UNKNOWN_EC, 1, 841 return add_to_list(ai, pnum, UBI_UNKNOWN, 1,
842 &ai->erase); 842 &ai->erase);
843 case UBI_IO_BAD_HDR_EBADMSG: 843 case UBI_IO_BAD_HDR_EBADMSG:
844 case UBI_IO_BAD_HDR: 844 case UBI_IO_BAD_HDR:
@@ -848,7 +848,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
848 * moved and EC be re-created. 848 * moved and EC be re-created.
849 */ 849 */
850 ec_err = err; 850 ec_err = err;
851 ec = UBI_SCAN_UNKNOWN_EC; 851 ec = UBI_UNKNOWN;
852 bitflips = 1; 852 bitflips = 1;
853 break; 853 break;
854 default: 854 default:
@@ -1172,21 +1172,21 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi)
1172 */ 1172 */
1173 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { 1173 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
1174 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) 1174 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb)
1175 if (aeb->ec == UBI_SCAN_UNKNOWN_EC) 1175 if (aeb->ec == UBI_UNKNOWN)
1176 aeb->ec = ai->mean_ec; 1176 aeb->ec = ai->mean_ec;
1177 } 1177 }
1178 1178
1179 list_for_each_entry(aeb, &ai->free, u.list) { 1179 list_for_each_entry(aeb, &ai->free, u.list) {
1180 if (aeb->ec == UBI_SCAN_UNKNOWN_EC) 1180 if (aeb->ec == UBI_UNKNOWN)
1181 aeb->ec = ai->mean_ec; 1181 aeb->ec = ai->mean_ec;
1182 } 1182 }
1183 1183
1184 list_for_each_entry(aeb, &ai->corr, u.list) 1184 list_for_each_entry(aeb, &ai->corr, u.list)
1185 if (aeb->ec == UBI_SCAN_UNKNOWN_EC) 1185 if (aeb->ec == UBI_UNKNOWN)
1186 aeb->ec = ai->mean_ec; 1186 aeb->ec = ai->mean_ec;
1187 1187
1188 list_for_each_entry(aeb, &ai->erase, u.list) 1188 list_for_each_entry(aeb, &ai->erase, u.list)
1189 if (aeb->ec == UBI_SCAN_UNKNOWN_EC) 1189 if (aeb->ec == UBI_UNKNOWN)
1190 aeb->ec = ai->mean_ec; 1190 aeb->ec = ai->mean_ec;
1191 1191
1192 err = self_check_ai(ubi, ai); 1192 err = self_check_ai(ubi, ai);
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h
index 3e0c4f494edf..e79524313d4b 100644
--- a/drivers/mtd/ubi/scan.h
+++ b/drivers/mtd/ubi/scan.h
@@ -21,12 +21,15 @@
21#ifndef __UBI_SCAN_H__ 21#ifndef __UBI_SCAN_H__
22#define __UBI_SCAN_H__ 22#define __UBI_SCAN_H__
23 23
24/* The erase counter value for this physical eraseblock is unknown */ 24/*
25#define UBI_SCAN_UNKNOWN_EC (-1) 25 * When a field of the attaching information has this value - its real value is
26 * unknown.
27 */
28#define UBI_UNKNOWN (-1)
26 29
27/** 30/**
28 * struct ubi_ainf_peb - attach information about a physical eraseblock. 31 * struct ubi_ainf_peb - attach information about a physical eraseblock.
29 * @ec: erase counter (%UBI_SCAN_UNKNOWN_EC if it is unknown) 32 * @ec: erase counter (%UBI_UNKNOWN if it is unknown)
30 * @pnum: physical eraseblock number 33 * @pnum: physical eraseblock number
31 * @lnum: logical eraseblock number 34 * @lnum: logical eraseblock number
32 * @scrub: if this physical eraseblock needs scrubbing 35 * @scrub: if this physical eraseblock needs scrubbing