diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-23 10:30:16 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:19 -0500 |
commit | 329ad399a9b3adf52c90637b21ca029fcf7f8795 (patch) | |
tree | 7aa7bb2609c25de7859c3a666f3ea90934609592 /drivers/mtd/ar7part.c | |
parent | 04c601bfa4cb29c968dcb66e44c799c9c01d8675 (diff) |
mtd: introduce mtd_read interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/ar7part.c')
-rw-r--r-- | drivers/mtd/ar7part.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/mtd/ar7part.c b/drivers/mtd/ar7part.c index f40ea4547554..945393129952 100644 --- a/drivers/mtd/ar7part.c +++ b/drivers/mtd/ar7part.c | |||
@@ -73,8 +73,8 @@ static int create_mtd_partitions(struct mtd_info *master, | |||
73 | 73 | ||
74 | do { /* Try 10 blocks starting from master->erasesize */ | 74 | do { /* Try 10 blocks starting from master->erasesize */ |
75 | offset = pre_size; | 75 | offset = pre_size; |
76 | master->read(master, offset, | 76 | mtd_read(master, offset, sizeof(header), &len, |
77 | sizeof(header), &len, (uint8_t *)&header); | 77 | (uint8_t *)&header); |
78 | if (!strncmp((char *)&header, "TIENV0.8", 8)) | 78 | if (!strncmp((char *)&header, "TIENV0.8", 8)) |
79 | ar7_parts[1].offset = pre_size; | 79 | ar7_parts[1].offset = pre_size; |
80 | if (header.checksum == LOADER_MAGIC1) | 80 | if (header.checksum == LOADER_MAGIC1) |
@@ -95,16 +95,16 @@ static int create_mtd_partitions(struct mtd_info *master, | |||
95 | case LOADER_MAGIC1: | 95 | case LOADER_MAGIC1: |
96 | while (header.length) { | 96 | while (header.length) { |
97 | offset += sizeof(header) + header.length; | 97 | offset += sizeof(header) + header.length; |
98 | master->read(master, offset, sizeof(header), | 98 | mtd_read(master, offset, sizeof(header), &len, |
99 | &len, (uint8_t *)&header); | 99 | (uint8_t *)&header); |
100 | } | 100 | } |
101 | root_offset = offset + sizeof(header) + 4; | 101 | root_offset = offset + sizeof(header) + 4; |
102 | break; | 102 | break; |
103 | case LOADER_MAGIC2: | 103 | case LOADER_MAGIC2: |
104 | while (header.length) { | 104 | while (header.length) { |
105 | offset += sizeof(header) + header.length; | 105 | offset += sizeof(header) + header.length; |
106 | master->read(master, offset, sizeof(header), | 106 | mtd_read(master, offset, sizeof(header), &len, |
107 | &len, (uint8_t *)&header); | 107 | (uint8_t *)&header); |
108 | } | 108 | } |
109 | root_offset = offset + sizeof(header) + 4 + 0xff; | 109 | root_offset = offset + sizeof(header) + 4 + 0xff; |
110 | root_offset &= ~(uint32_t)0xff; | 110 | root_offset &= ~(uint32_t)0xff; |
@@ -114,8 +114,7 @@ static int create_mtd_partitions(struct mtd_info *master, | |||
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | 116 | ||
117 | master->read(master, root_offset, | 117 | mtd_read(master, root_offset, sizeof(header), &len, (u8 *)&header); |
118 | sizeof(header), &len, (u8 *)&header); | ||
119 | if (header.checksum != SQUASHFS_MAGIC) { | 118 | if (header.checksum != SQUASHFS_MAGIC) { |
120 | root_offset += master->erasesize - 1; | 119 | root_offset += master->erasesize - 1; |
121 | root_offset &= ~(master->erasesize - 1); | 120 | root_offset &= ~(master->erasesize - 1); |