UBI: nicify image sequence number handling
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 30 Jun 2009 13:11:59 +0000 (16:11 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 10 Jul 2009 09:16:28 +0000 (12:16 +0300)
Move the image seq. number handling from I/O level to the scanning
lever, where it really belongs to. Move the @image_seq_set variable
to the @struct ubi_scan_info structure, which exists only during
scanning.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/io.c
drivers/mtd/ubi/scan.c
drivers/mtd/ubi/scan.h
drivers/mtd/ubi/ubi.h

index c7f57cb..769adc7 100644 (file)
@@ -563,16 +563,15 @@ int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum)
  * This function returns zero if the erase counter header is OK, and %1 if
  * not.
  */
-static int validate_ec_hdr(struct ubi_device *ubi,
+static int validate_ec_hdr(const struct ubi_device *ubi,
                           const struct ubi_ec_hdr *ec_hdr)
 {
        long long ec;
-       int vid_hdr_offset, leb_start, image_seq;
+       int vid_hdr_offset, leb_start;
 
        ec = be64_to_cpu(ec_hdr->ec);
        vid_hdr_offset = be32_to_cpu(ec_hdr->vid_hdr_offset);
        leb_start = be32_to_cpu(ec_hdr->data_offset);
-       image_seq = be32_to_cpu(ec_hdr->image_seq);
 
        if (ec_hdr->version != UBI_VERSION) {
                ubi_err("node with incompatible UBI version found: "
@@ -598,15 +597,6 @@ static int validate_ec_hdr(struct ubi_device *ubi,
                goto bad;
        }
 
-       if (!ubi->image_seq_set) {
-               ubi->image_seq = image_seq;
-               ubi->image_seq_set = 1;
-       } else if (ubi->image_seq != image_seq) {
-               ubi_err("bad image sequence number %d, expected %d",
-                       image_seq, ubi->image_seq);
-               goto bad;
-       }
-
        return 0;
 
 bad:
Simple merge
Simple merge
Simple merge