aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/eba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r--drivers/mtd/ubi/eba.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 6964fe4ab41a..a1820151e9f9 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -425,10 +425,10 @@ retry:
425 } else if (err == UBI_IO_BITFLIPS) 425 } else if (err == UBI_IO_BITFLIPS)
426 scrub = 1; 426 scrub = 1;
427 427
428 ubi_assert(lnum < ubi32_to_cpu(vid_hdr->used_ebs)); 428 ubi_assert(lnum < be32_to_cpu(vid_hdr->used_ebs));
429 ubi_assert(len == ubi32_to_cpu(vid_hdr->data_size)); 429 ubi_assert(len == be32_to_cpu(vid_hdr->data_size));
430 430
431 crc = ubi32_to_cpu(vid_hdr->data_crc); 431 crc = be32_to_cpu(vid_hdr->data_crc);
432 ubi_free_vid_hdr(ubi, vid_hdr); 432 ubi_free_vid_hdr(ubi, vid_hdr);
433 } 433 }
434 434
@@ -518,7 +518,7 @@ retry:
518 goto out_put; 518 goto out_put;
519 } 519 }
520 520
521 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 521 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
522 err = ubi_io_write_vid_hdr(ubi, new_pnum, vid_hdr); 522 err = ubi_io_write_vid_hdr(ubi, new_pnum, vid_hdr);
523 if (err) 523 if (err)
524 goto write_error; 524 goto write_error;
@@ -634,11 +634,11 @@ int ubi_eba_write_leb(struct ubi_device *ubi, int vol_id, int lnum,
634 } 634 }
635 635
636 vid_hdr->vol_type = UBI_VID_DYNAMIC; 636 vid_hdr->vol_type = UBI_VID_DYNAMIC;
637 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 637 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
638 vid_hdr->vol_id = cpu_to_ubi32(vol_id); 638 vid_hdr->vol_id = cpu_to_be32(vol_id);
639 vid_hdr->lnum = cpu_to_ubi32(lnum); 639 vid_hdr->lnum = cpu_to_be32(lnum);
640 vid_hdr->compat = ubi_get_compat(ubi, vol_id); 640 vid_hdr->compat = ubi_get_compat(ubi, vol_id);
641 vid_hdr->data_pad = cpu_to_ubi32(vol->data_pad); 641 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
642 642
643retry: 643retry:
644 pnum = ubi_wl_get_peb(ubi, dtype); 644 pnum = ubi_wl_get_peb(ubi, dtype);
@@ -692,7 +692,7 @@ write_error:
692 return err; 692 return err;
693 } 693 }
694 694
695 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 695 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
696 ubi_msg("try another PEB"); 696 ubi_msg("try another PEB");
697 goto retry; 697 goto retry;
698} 698}
@@ -748,17 +748,17 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, int vol_id, int lnum,
748 return err; 748 return err;
749 } 749 }
750 750
751 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 751 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
752 vid_hdr->vol_id = cpu_to_ubi32(vol_id); 752 vid_hdr->vol_id = cpu_to_be32(vol_id);
753 vid_hdr->lnum = cpu_to_ubi32(lnum); 753 vid_hdr->lnum = cpu_to_be32(lnum);
754 vid_hdr->compat = ubi_get_compat(ubi, vol_id); 754 vid_hdr->compat = ubi_get_compat(ubi, vol_id);
755 vid_hdr->data_pad = cpu_to_ubi32(vol->data_pad); 755 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
756 756
757 crc = crc32(UBI_CRC32_INIT, buf, data_size); 757 crc = crc32(UBI_CRC32_INIT, buf, data_size);
758 vid_hdr->vol_type = UBI_VID_STATIC; 758 vid_hdr->vol_type = UBI_VID_STATIC;
759 vid_hdr->data_size = cpu_to_ubi32(data_size); 759 vid_hdr->data_size = cpu_to_be32(data_size);
760 vid_hdr->used_ebs = cpu_to_ubi32(used_ebs); 760 vid_hdr->used_ebs = cpu_to_be32(used_ebs);
761 vid_hdr->data_crc = cpu_to_ubi32(crc); 761 vid_hdr->data_crc = cpu_to_be32(crc);
762 762
763retry: 763retry:
764 pnum = ubi_wl_get_peb(ubi, dtype); 764 pnum = ubi_wl_get_peb(ubi, dtype);
@@ -813,7 +813,7 @@ write_error:
813 return err; 813 return err;
814 } 814 }
815 815
816 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 816 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
817 ubi_msg("try another PEB"); 817 ubi_msg("try another PEB");
818 goto retry; 818 goto retry;
819} 819}
@@ -854,17 +854,17 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
854 return err; 854 return err;
855 } 855 }
856 856
857 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 857 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
858 vid_hdr->vol_id = cpu_to_ubi32(vol_id); 858 vid_hdr->vol_id = cpu_to_be32(vol_id);
859 vid_hdr->lnum = cpu_to_ubi32(lnum); 859 vid_hdr->lnum = cpu_to_be32(lnum);
860 vid_hdr->compat = ubi_get_compat(ubi, vol_id); 860 vid_hdr->compat = ubi_get_compat(ubi, vol_id);
861 vid_hdr->data_pad = cpu_to_ubi32(vol->data_pad); 861 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
862 862
863 crc = crc32(UBI_CRC32_INIT, buf, len); 863 crc = crc32(UBI_CRC32_INIT, buf, len);
864 vid_hdr->vol_type = UBI_VID_STATIC; 864 vid_hdr->vol_type = UBI_VID_STATIC;
865 vid_hdr->data_size = cpu_to_ubi32(len); 865 vid_hdr->data_size = cpu_to_be32(len);
866 vid_hdr->copy_flag = 1; 866 vid_hdr->copy_flag = 1;
867 vid_hdr->data_crc = cpu_to_ubi32(crc); 867 vid_hdr->data_crc = cpu_to_be32(crc);
868 868
869retry: 869retry:
870 pnum = ubi_wl_get_peb(ubi, dtype); 870 pnum = ubi_wl_get_peb(ubi, dtype);
@@ -924,7 +924,7 @@ write_error:
924 return err; 924 return err;
925 } 925 }
926 926
927 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 927 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
928 ubi_msg("try another PEB"); 928 ubi_msg("try another PEB");
929 goto retry; 929 goto retry;
930} 930}
@@ -965,17 +965,17 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
965 uint32_t crc; 965 uint32_t crc;
966 void *buf, *buf1 = NULL; 966 void *buf, *buf1 = NULL;
967 967
968 vol_id = ubi32_to_cpu(vid_hdr->vol_id); 968 vol_id = be32_to_cpu(vid_hdr->vol_id);
969 lnum = ubi32_to_cpu(vid_hdr->lnum); 969 lnum = be32_to_cpu(vid_hdr->lnum);
970 970
971 dbg_eba("copy LEB %d:%d, PEB %d to PEB %d", vol_id, lnum, from, to); 971 dbg_eba("copy LEB %d:%d, PEB %d to PEB %d", vol_id, lnum, from, to);
972 972
973 if (vid_hdr->vol_type == UBI_VID_STATIC) { 973 if (vid_hdr->vol_type == UBI_VID_STATIC) {
974 data_size = ubi32_to_cpu(vid_hdr->data_size); 974 data_size = be32_to_cpu(vid_hdr->data_size);
975 aldata_size = ALIGN(data_size, ubi->min_io_size); 975 aldata_size = ALIGN(data_size, ubi->min_io_size);
976 } else 976 } else
977 data_size = aldata_size = 977 data_size = aldata_size =
978 ubi->leb_size - ubi32_to_cpu(vid_hdr->data_pad); 978 ubi->leb_size - be32_to_cpu(vid_hdr->data_pad);
979 979
980 buf = vmalloc(aldata_size); 980 buf = vmalloc(aldata_size);
981 if (!buf) 981 if (!buf)
@@ -1054,10 +1054,10 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
1054 */ 1054 */
1055 if (data_size > 0) { 1055 if (data_size > 0) {
1056 vid_hdr->copy_flag = 1; 1056 vid_hdr->copy_flag = 1;
1057 vid_hdr->data_size = cpu_to_ubi32(data_size); 1057 vid_hdr->data_size = cpu_to_be32(data_size);
1058 vid_hdr->data_crc = cpu_to_ubi32(crc); 1058 vid_hdr->data_crc = cpu_to_be32(crc);
1059 } 1059 }
1060 vid_hdr->sqnum = cpu_to_ubi64(next_sqnum(ubi)); 1060 vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
1061 1061
1062 err = ubi_io_write_vid_hdr(ubi, to, vid_hdr); 1062 err = ubi_io_write_vid_hdr(ubi, to, vid_hdr);
1063 if (err) 1063 if (err)