aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-11-19 18:35:20 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-30 06:54:41 -0500
commit41c043842f047af682daf4940a1fc6dfc807bdbb (patch)
tree5d55a880bd34c6ca934e7b4fe21eb7b53cf53060 /drivers/mtd
parentd125a753425b9de3c251df519e521024c79c663d (diff)
UBI: gluebi: rename misleading variables
Both names 'total_read' and 'total_written' are actually used as the number of bytes left to read and write. Fix this confusion by renaming both to 'bytes_left'. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/gluebi.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c
index 4bd4db8c84c9..b93807b4c459 100644
--- a/drivers/mtd/ubi/gluebi.c
+++ b/drivers/mtd/ubi/gluebi.c
@@ -171,17 +171,17 @@ static void gluebi_put_device(struct mtd_info *mtd)
171static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len, 171static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
172 size_t *retlen, unsigned char *buf) 172 size_t *retlen, unsigned char *buf)
173{ 173{
174 int err = 0, lnum, offs, total_read; 174 int err = 0, lnum, offs, bytes_left;
175 struct gluebi_device *gluebi; 175 struct gluebi_device *gluebi;
176 176
177 gluebi = container_of(mtd, struct gluebi_device, mtd); 177 gluebi = container_of(mtd, struct gluebi_device, mtd);
178 lnum = div_u64_rem(from, mtd->erasesize, &offs); 178 lnum = div_u64_rem(from, mtd->erasesize, &offs);
179 total_read = len; 179 bytes_left = len;
180 while (total_read) { 180 while (bytes_left) {
181 size_t to_read = mtd->erasesize - offs; 181 size_t to_read = mtd->erasesize - offs;
182 182
183 if (to_read > total_read) 183 if (to_read > bytes_left)
184 to_read = total_read; 184 to_read = bytes_left;
185 185
186 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); 186 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read);
187 if (err) 187 if (err)
@@ -189,11 +189,11 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
189 189
190 lnum += 1; 190 lnum += 1;
191 offs = 0; 191 offs = 0;
192 total_read -= to_read; 192 bytes_left -= to_read;
193 buf += to_read; 193 buf += to_read;
194 } 194 }
195 195
196 *retlen = len - total_read; 196 *retlen = len - bytes_left;
197 return err; 197 return err;
198} 198}
199 199
@@ -211,7 +211,7 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
211static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, 211static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
212 size_t *retlen, const u_char *buf) 212 size_t *retlen, const u_char *buf)
213{ 213{
214 int err = 0, lnum, offs, total_written; 214 int err = 0, lnum, offs, bytes_left;
215 struct gluebi_device *gluebi; 215 struct gluebi_device *gluebi;
216 216
217 gluebi = container_of(mtd, struct gluebi_device, mtd); 217 gluebi = container_of(mtd, struct gluebi_device, mtd);
@@ -220,12 +220,12 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
220 if (len % mtd->writesize || offs % mtd->writesize) 220 if (len % mtd->writesize || offs % mtd->writesize)
221 return -EINVAL; 221 return -EINVAL;
222 222
223 total_written = len; 223 bytes_left = len;
224 while (total_written) { 224 while (bytes_left) {
225 size_t to_write = mtd->erasesize - offs; 225 size_t to_write = mtd->erasesize - offs;
226 226
227 if (to_write > total_written) 227 if (to_write > bytes_left)
228 to_write = total_written; 228 to_write = bytes_left;
229 229
230 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); 230 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write);
231 if (err) 231 if (err)
@@ -233,11 +233,11 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
233 233
234 lnum += 1; 234 lnum += 1;
235 offs = 0; 235 offs = 0;
236 total_written -= to_write; 236 bytes_left -= to_write;
237 buf += to_write; 237 buf += to_write;
238 } 238 }
239 239
240 *retlen = len - total_written; 240 *retlen = len - bytes_left;
241 return err; 241 return err;
242} 242}
243 243