Skip to content

Commit 41c0438

Browse files
ezequielgarciadedekind
authored andcommitted
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>
1 parent d125a75 commit 41c0438

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/mtd/ubi/gluebi.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,29 +171,29 @@ static void gluebi_put_device(struct mtd_info *mtd)
171171
static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
172172
size_t *retlen, unsigned char *buf)
173173
{
174-
int err = 0, lnum, offs, total_read;
174+
int err = 0, lnum, offs, bytes_left;
175175
struct gluebi_device *gluebi;
176176

177177
gluebi = container_of(mtd, struct gluebi_device, mtd);
178178
lnum = div_u64_rem(from, mtd->erasesize, &offs);
179-
total_read = len;
180-
while (total_read) {
179+
bytes_left = len;
180+
while (bytes_left) {
181181
size_t to_read = mtd->erasesize - offs;
182182

183-
if (to_read > total_read)
184-
to_read = total_read;
183+
if (to_read > bytes_left)
184+
to_read = bytes_left;
185185

186186
err = ubi_read(gluebi->desc, lnum, buf, offs, to_read);
187187
if (err)
188188
break;
189189

190190
lnum += 1;
191191
offs = 0;
192-
total_read -= to_read;
192+
bytes_left -= to_read;
193193
buf += to_read;
194194
}
195195

196-
*retlen = len - total_read;
196+
*retlen = len - bytes_left;
197197
return err;
198198
}
199199

@@ -211,7 +211,7 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
211211
static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
212212
size_t *retlen, const u_char *buf)
213213
{
214-
int err = 0, lnum, offs, total_written;
214+
int err = 0, lnum, offs, bytes_left;
215215
struct gluebi_device *gluebi;
216216

217217
gluebi = container_of(mtd, struct gluebi_device, mtd);
@@ -220,24 +220,24 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
220220
if (len % mtd->writesize || offs % mtd->writesize)
221221
return -EINVAL;
222222

223-
total_written = len;
224-
while (total_written) {
223+
bytes_left = len;
224+
while (bytes_left) {
225225
size_t to_write = mtd->erasesize - offs;
226226

227-
if (to_write > total_written)
228-
to_write = total_written;
227+
if (to_write > bytes_left)
228+
to_write = bytes_left;
229229

230230
err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write);
231231
if (err)
232232
break;
233233

234234
lnum += 1;
235235
offs = 0;
236-
total_written -= to_write;
236+
bytes_left -= to_write;
237237
buf += to_write;
238238
}
239239

240-
*retlen = len - total_written;
240+
*retlen = len - bytes_left;
241241
return err;
242242
}
243243

0 commit comments

Comments
 (0)