aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ar7part.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ar7part.c')
-rw-r--r--drivers/mtd/ar7part.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/mtd/ar7part.c b/drivers/mtd/ar7part.c
index 7722608d5a83..ecf170b55c32 100644
--- a/drivers/mtd/ar7part.c
+++ b/drivers/mtd/ar7part.c
@@ -34,6 +34,10 @@
34#define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42) 34#define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42)
35#define LOADER_MAGIC2 le32_to_cpu(0xfeed1281) 35#define LOADER_MAGIC2 le32_to_cpu(0xfeed1281)
36 36
37#ifndef SQUASHFS_MAGIC
38#define SQUASHFS_MAGIC 0x73717368
39#endif
40
37struct ar7_bin_rec { 41struct ar7_bin_rec {
38 unsigned int checksum; 42 unsigned int checksum;
39 unsigned int length; 43 unsigned int length;
@@ -47,7 +51,8 @@ static int create_mtd_partitions(struct mtd_info *master,
47 unsigned long origin) 51 unsigned long origin)
48{ 52{
49 struct ar7_bin_rec header; 53 struct ar7_bin_rec header;
50 unsigned int offset, len; 54 unsigned int offset;
55 size_t len;
51 unsigned int pre_size = master->erasesize, post_size = 0; 56 unsigned int pre_size = master->erasesize, post_size = 0;
52 unsigned int root_offset = ROOT_OFFSET; 57 unsigned int root_offset = ROOT_OFFSET;
53 58
@@ -66,7 +71,7 @@ static int create_mtd_partitions(struct mtd_info *master,
66 do { /* Try 10 blocks starting from master->erasesize */ 71 do { /* Try 10 blocks starting from master->erasesize */
67 offset = pre_size; 72 offset = pre_size;
68 master->read(master, offset, 73 master->read(master, offset,
69 sizeof(header), &len, (u8 *)&header); 74 sizeof(header), &len, (uint8_t *)&header);
70 if (!strncmp((char *)&header, "TIENV0.8", 8)) 75 if (!strncmp((char *)&header, "TIENV0.8", 8))
71 ar7_parts[1].offset = pre_size; 76 ar7_parts[1].offset = pre_size;
72 if (header.checksum == LOADER_MAGIC1) 77 if (header.checksum == LOADER_MAGIC1)
@@ -88,7 +93,7 @@ static int create_mtd_partitions(struct mtd_info *master,
88 while (header.length) { 93 while (header.length) {
89 offset += sizeof(header) + header.length; 94 offset += sizeof(header) + header.length;
90 master->read(master, offset, sizeof(header), 95 master->read(master, offset, sizeof(header),
91 &len, (u8 *)&header); 96 &len, (uint8_t *)&header);
92 } 97 }
93 root_offset = offset + sizeof(header) + 4; 98 root_offset = offset + sizeof(header) + 4;
94 break; 99 break;
@@ -96,10 +101,10 @@ static int create_mtd_partitions(struct mtd_info *master,
96 while (header.length) { 101 while (header.length) {
97 offset += sizeof(header) + header.length; 102 offset += sizeof(header) + header.length;
98 master->read(master, offset, sizeof(header), 103 master->read(master, offset, sizeof(header),
99 &len, (u8 *)&header); 104 &len, (uint8_t *)&header);
100 } 105 }
101 root_offset = offset + sizeof(header) + 4 + 0xff; 106 root_offset = offset + sizeof(header) + 4 + 0xff;
102 root_offset &= ~(u32)0xff; 107 root_offset &= ~(uint32_t)0xff;
103 break; 108 break;
104 default: 109 default:
105 printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum); 110 printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum);