aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-05-21 10:41:46 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-18 09:53:49 -0400
commit3261ebd7d4194ff30d0eae7ba8d937dcccf7235d (patch)
tree75381f6dd24263cdf484ebc9a5c8a93db6d83cb4 /drivers/mtd/ubi/vtbl.c
parentbf07803a6827ef8d4c9d840a1de800ba36db0213 (diff)
UBI: kill homegrown endian macros
Kill UBI's homegrown endianess handling and replace it with the standard kernel endianess handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index e3557b987efd..800ce940a820 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -93,7 +93,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
93 vtbl_rec = &empty_vtbl_record; 93 vtbl_rec = &empty_vtbl_record;
94 else { 94 else {
95 crc = crc32(UBI_CRC32_INIT, vtbl_rec, UBI_VTBL_RECORD_SIZE_CRC); 95 crc = crc32(UBI_CRC32_INIT, vtbl_rec, UBI_VTBL_RECORD_SIZE_CRC);
96 vtbl_rec->crc = cpu_to_ubi32(crc); 96 vtbl_rec->crc = cpu_to_be32(crc);
97 } 97 }
98 98
99 dbg_msg("change record %d", idx); 99 dbg_msg("change record %d", idx);
@@ -141,18 +141,18 @@ static int vtbl_check(const struct ubi_device *ubi,
141 for (i = 0; i < ubi->vtbl_slots; i++) { 141 for (i = 0; i < ubi->vtbl_slots; i++) {
142 cond_resched(); 142 cond_resched();
143 143
144 reserved_pebs = ubi32_to_cpu(vtbl[i].reserved_pebs); 144 reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
145 alignment = ubi32_to_cpu(vtbl[i].alignment); 145 alignment = be32_to_cpu(vtbl[i].alignment);
146 data_pad = ubi32_to_cpu(vtbl[i].data_pad); 146 data_pad = be32_to_cpu(vtbl[i].data_pad);
147 upd_marker = vtbl[i].upd_marker; 147 upd_marker = vtbl[i].upd_marker;
148 vol_type = vtbl[i].vol_type; 148 vol_type = vtbl[i].vol_type;
149 name_len = ubi16_to_cpu(vtbl[i].name_len); 149 name_len = be16_to_cpu(vtbl[i].name_len);
150 name = &vtbl[i].name[0]; 150 name = &vtbl[i].name[0];
151 151
152 crc = crc32(UBI_CRC32_INIT, &vtbl[i], UBI_VTBL_RECORD_SIZE_CRC); 152 crc = crc32(UBI_CRC32_INIT, &vtbl[i], UBI_VTBL_RECORD_SIZE_CRC);
153 if (ubi32_to_cpu(vtbl[i].crc) != crc) { 153 if (be32_to_cpu(vtbl[i].crc) != crc) {
154 ubi_err("bad CRC at record %u: %#08x, not %#08x", 154 ubi_err("bad CRC at record %u: %#08x, not %#08x",
155 i, crc, ubi32_to_cpu(vtbl[i].crc)); 155 i, crc, be32_to_cpu(vtbl[i].crc));
156 ubi_dbg_dump_vtbl_record(&vtbl[i], i); 156 ubi_dbg_dump_vtbl_record(&vtbl[i], i);
157 return 1; 157 return 1;
158 } 158 }
@@ -225,8 +225,8 @@ static int vtbl_check(const struct ubi_device *ubi,
225 /* Checks that all names are unique */ 225 /* Checks that all names are unique */
226 for (i = 0; i < ubi->vtbl_slots - 1; i++) { 226 for (i = 0; i < ubi->vtbl_slots - 1; i++) {
227 for (n = i + 1; n < ubi->vtbl_slots; n++) { 227 for (n = i + 1; n < ubi->vtbl_slots; n++) {
228 int len1 = ubi16_to_cpu(vtbl[i].name_len); 228 int len1 = be16_to_cpu(vtbl[i].name_len);
229 int len2 = ubi16_to_cpu(vtbl[n].name_len); 229 int len2 = be16_to_cpu(vtbl[n].name_len);
230 230
231 if (len1 > 0 && len1 == len2 && 231 if (len1 > 0 && len1 == len2 &&
232 !strncmp(vtbl[i].name, vtbl[n].name, len1)) { 232 !strncmp(vtbl[i].name, vtbl[n].name, len1)) {
@@ -288,13 +288,13 @@ retry:
288 } 288 }
289 289
290 vid_hdr->vol_type = UBI_VID_DYNAMIC; 290 vid_hdr->vol_type = UBI_VID_DYNAMIC;
291 vid_hdr->vol_id = cpu_to_ubi32(UBI_LAYOUT_VOL_ID); 291 vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOL_ID);
292 vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT; 292 vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT;
293 vid_hdr->data_size = vid_hdr->used_ebs = 293 vid_hdr->data_size = vid_hdr->used_ebs =
294 vid_hdr->data_pad = cpu_to_ubi32(0); 294 vid_hdr->data_pad = cpu_to_be32(0);
295 vid_hdr->lnum = cpu_to_ubi32(copy); 295 vid_hdr->lnum = cpu_to_be32(copy);
296 vid_hdr->sqnum = cpu_to_ubi64(++si->max_sqnum); 296 vid_hdr->sqnum = cpu_to_be64(++si->max_sqnum);
297 vid_hdr->leb_ver = cpu_to_ubi32(old_seb ? old_seb->leb_ver + 1: 0); 297 vid_hdr->leb_ver = cpu_to_be32(old_seb ? old_seb->leb_ver + 1: 0);
298 298
299 /* The EC header is already there, write the VID header */ 299 /* The EC header is already there, write the VID header */
300 err = ubi_io_write_vid_hdr(ubi, new_seb->pnum, vid_hdr); 300 err = ubi_io_write_vid_hdr(ubi, new_seb->pnum, vid_hdr);
@@ -503,19 +503,19 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
503 for (i = 0; i < ubi->vtbl_slots; i++) { 503 for (i = 0; i < ubi->vtbl_slots; i++) {
504 cond_resched(); 504 cond_resched();
505 505
506 if (ubi32_to_cpu(vtbl[i].reserved_pebs) == 0) 506 if (be32_to_cpu(vtbl[i].reserved_pebs) == 0)
507 continue; /* Empty record */ 507 continue; /* Empty record */
508 508
509 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL); 509 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL);
510 if (!vol) 510 if (!vol)
511 return -ENOMEM; 511 return -ENOMEM;
512 512
513 vol->reserved_pebs = ubi32_to_cpu(vtbl[i].reserved_pebs); 513 vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
514 vol->alignment = ubi32_to_cpu(vtbl[i].alignment); 514 vol->alignment = be32_to_cpu(vtbl[i].alignment);
515 vol->data_pad = ubi32_to_cpu(vtbl[i].data_pad); 515 vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
516 vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ? 516 vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
517 UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME; 517 UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
518 vol->name_len = ubi16_to_cpu(vtbl[i].name_len); 518 vol->name_len = be16_to_cpu(vtbl[i].name_len);
519 vol->usable_leb_size = ubi->leb_size - vol->data_pad; 519 vol->usable_leb_size = ubi->leb_size - vol->data_pad;
520 memcpy(vol->name, vtbl[i].name, vol->name_len); 520 memcpy(vol->name, vtbl[i].name, vol->name_len);
521 vol->name[vol->name_len] = '\0'; 521 vol->name[vol->name_len] = '\0';
@@ -721,7 +721,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si)
721 int i, err; 721 int i, err;
722 struct ubi_scan_volume *sv; 722 struct ubi_scan_volume *sv;
723 723
724 empty_vtbl_record.crc = cpu_to_ubi32(0xf116c36b); 724 empty_vtbl_record.crc = cpu_to_be32(0xf116c36b);
725 725
726 /* 726 /*
727 * The number of supported volumes is limited by the eraseblock size 727 * The number of supported volumes is limited by the eraseblock size