diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-06-30 09:11:59 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-07-05 11:47:08 -0400 |
commit | fe96efc1a3c049f0a1bcd9b65e0faeb751ce5ec6 (patch) | |
tree | 5c750ab134bb1037eeaf5baa8d9eee6196566226 /drivers/mtd/ubi/io.c | |
parent | 0c6c7fa1313fcb69cae35e34168d2e83b8da854a (diff) |
UBI: nicify image sequence number handling
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>
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index b58714011091..1ea14218de02 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -563,16 +563,15 @@ int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum) | |||
563 | * This function returns zero if the erase counter header is OK, and %1 if | 563 | * This function returns zero if the erase counter header is OK, and %1 if |
564 | * not. | 564 | * not. |
565 | */ | 565 | */ |
566 | static int validate_ec_hdr(struct ubi_device *ubi, | 566 | static int validate_ec_hdr(const struct ubi_device *ubi, |
567 | const struct ubi_ec_hdr *ec_hdr) | 567 | const struct ubi_ec_hdr *ec_hdr) |
568 | { | 568 | { |
569 | long long ec; | 569 | long long ec; |
570 | int vid_hdr_offset, leb_start, image_seq; | 570 | int vid_hdr_offset, leb_start; |
571 | 571 | ||
572 | ec = be64_to_cpu(ec_hdr->ec); | 572 | ec = be64_to_cpu(ec_hdr->ec); |
573 | vid_hdr_offset = be32_to_cpu(ec_hdr->vid_hdr_offset); | 573 | vid_hdr_offset = be32_to_cpu(ec_hdr->vid_hdr_offset); |
574 | leb_start = be32_to_cpu(ec_hdr->data_offset); | 574 | leb_start = be32_to_cpu(ec_hdr->data_offset); |
575 | image_seq = be32_to_cpu(ec_hdr->image_seq); | ||
576 | 575 | ||
577 | if (ec_hdr->version != UBI_VERSION) { | 576 | if (ec_hdr->version != UBI_VERSION) { |
578 | ubi_err("node with incompatible UBI version found: " | 577 | ubi_err("node with incompatible UBI version found: " |
@@ -598,15 +597,6 @@ static int validate_ec_hdr(struct ubi_device *ubi, | |||
598 | goto bad; | 597 | goto bad; |
599 | } | 598 | } |
600 | 599 | ||
601 | if (!ubi->image_seq_set) { | ||
602 | ubi->image_seq = image_seq; | ||
603 | ubi->image_seq_set = 1; | ||
604 | } else if (ubi->image_seq != image_seq) { | ||
605 | ubi_err("bad image sequence number %d, expected %d", | ||
606 | image_seq, ubi->image_seq); | ||
607 | goto bad; | ||
608 | } | ||
609 | |||
610 | return 0; | 600 | return 0; |
611 | 601 | ||
612 | bad: | 602 | bad: |