diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-07-31 02:37:34 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-10-19 10:19:57 -0400 |
commit | bb00e180a93a6c8e89c3b2d1f9473781e1e2d2a4 (patch) | |
tree | 87bd9ddc65052014e36e4fb0565e73d7ff4dd992 /drivers/mtd/ubi/io.c | |
parent | 0525dac9fd31e5a12fb934238abd09e2752a5967 (diff) |
UBI: make check_pattern function non-static
This patch turns static function 'check_pattern()' into a non-static
'ubi_check_pattern()'. This is just a preparation for the chages which
are coming in the next patches.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index b76252465c87..c2960ac9f39c 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -376,25 +376,6 @@ retry: | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | 378 | ||
379 | /** | ||
380 | * check_pattern - check if buffer contains only a certain byte pattern. | ||
381 | * @buf: buffer to check | ||
382 | * @patt: the pattern to check | ||
383 | * @size: buffer size in bytes | ||
384 | * | ||
385 | * This function returns %1 in there are only @patt bytes in @buf, and %0 if | ||
386 | * something else was also found. | ||
387 | */ | ||
388 | static int check_pattern(const void *buf, uint8_t patt, int size) | ||
389 | { | ||
390 | int i; | ||
391 | |||
392 | for (i = 0; i < size; i++) | ||
393 | if (((const uint8_t *)buf)[i] != patt) | ||
394 | return 0; | ||
395 | return 1; | ||
396 | } | ||
397 | |||
398 | /* Patterns to write to a physical eraseblock when torturing it */ | 379 | /* Patterns to write to a physical eraseblock when torturing it */ |
399 | static uint8_t patterns[] = {0xa5, 0x5a, 0x0}; | 380 | static uint8_t patterns[] = {0xa5, 0x5a, 0x0}; |
400 | 381 | ||
@@ -426,7 +407,7 @@ static int torture_peb(struct ubi_device *ubi, int pnum) | |||
426 | if (err) | 407 | if (err) |
427 | goto out; | 408 | goto out; |
428 | 409 | ||
429 | err = check_pattern(ubi->peb_buf1, 0xFF, ubi->peb_size); | 410 | err = ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->peb_size); |
430 | if (err == 0) { | 411 | if (err == 0) { |
431 | ubi_err("erased PEB %d, but a non-0xFF byte found", | 412 | ubi_err("erased PEB %d, but a non-0xFF byte found", |
432 | pnum); | 413 | pnum); |
@@ -445,7 +426,8 @@ static int torture_peb(struct ubi_device *ubi, int pnum) | |||
445 | if (err) | 426 | if (err) |
446 | goto out; | 427 | goto out; |
447 | 428 | ||
448 | err = check_pattern(ubi->peb_buf1, patterns[i], ubi->peb_size); | 429 | err = ubi_check_pattern(ubi->peb_buf1, patterns[i], |
430 | ubi->peb_size); | ||
449 | if (err == 0) { | 431 | if (err == 0) { |
450 | ubi_err("pattern %x checking failed for PEB %d", | 432 | ubi_err("pattern %x checking failed for PEB %d", |
451 | patterns[i], pnum); | 433 | patterns[i], pnum); |
@@ -752,7 +734,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
752 | * 0xFF. If yes, this physical eraseblock is assumed to be | 734 | * 0xFF. If yes, this physical eraseblock is assumed to be |
753 | * empty. | 735 | * empty. |
754 | */ | 736 | */ |
755 | if (check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { | 737 | if (ubi_check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { |
756 | /* The physical eraseblock is supposedly empty */ | 738 | /* The physical eraseblock is supposedly empty */ |
757 | if (verbose) | 739 | if (verbose) |
758 | ubi_warn("no EC header found at PEB %d, " | 740 | ubi_warn("no EC header found at PEB %d, " |
@@ -1009,7 +991,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
1009 | if (read_err == -EBADMSG) | 991 | if (read_err == -EBADMSG) |
1010 | return UBI_IO_BAD_HDR_EBADMSG; | 992 | return UBI_IO_BAD_HDR_EBADMSG; |
1011 | 993 | ||
1012 | if (check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { | 994 | if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { |
1013 | if (verbose) | 995 | if (verbose) |
1014 | ubi_warn("no VID header found at PEB %d, " | 996 | ubi_warn("no VID header found at PEB %d, " |
1015 | "only 0xFF bytes", pnum); | 997 | "only 0xFF bytes", pnum); |
@@ -1363,7 +1345,7 @@ int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len) | |||
1363 | goto error; | 1345 | goto error; |
1364 | } | 1346 | } |
1365 | 1347 | ||
1366 | err = check_pattern(ubi->dbg_peb_buf, 0xFF, len); | 1348 | err = ubi_check_pattern(ubi->dbg_peb_buf, 0xFF, len); |
1367 | if (err == 0) { | 1349 | if (err == 0) { |
1368 | ubi_err("flash region at PEB %d:%d, length %d does not " | 1350 | ubi_err("flash region at PEB %d:%d, length %d does not " |
1369 | "contain all 0xFF bytes", pnum, offset, len); | 1351 | "contain all 0xFF bytes", pnum, offset, len); |