Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+26 -24
+6 -24
drivers/mtd/ubi/io.c
··· 376 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 379 /* Patterns to write to a physical eraseblock when torturing it */ 399 380 static uint8_t patterns[] = {0xa5, 0x5a, 0x0}; 400 381 ··· 407 426 if (err) 408 427 goto out; 409 428 410 - err = check_pattern(ubi->peb_buf1, 0xFF, ubi->peb_size); 429 + err = ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->peb_size); 411 430 if (err == 0) { 412 431 ubi_err("erased PEB %d, but a non-0xFF byte found", 413 432 pnum); ··· 426 445 if (err) 427 446 goto out; 428 447 429 - err = check_pattern(ubi->peb_buf1, patterns[i], ubi->peb_size); 448 + err = ubi_check_pattern(ubi->peb_buf1, patterns[i], 449 + ubi->peb_size); 430 450 if (err == 0) { 431 451 ubi_err("pattern %x checking failed for PEB %d", 432 452 patterns[i], pnum); ··· 734 752 * 0xFF. If yes, this physical eraseblock is assumed to be 735 753 * empty. 736 754 */ 737 - if (check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { 755 + if (ubi_check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { 738 756 /* The physical eraseblock is supposedly empty */ 739 757 if (verbose) 740 758 ubi_warn("no EC header found at PEB %d, " ··· 991 1009 if (read_err == -EBADMSG) 992 1010 return UBI_IO_BAD_HDR_EBADMSG; 993 1011 994 - if (check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { 1012 + if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { 995 1013 if (verbose) 996 1014 ubi_warn("no VID header found at PEB %d, " 997 1015 "only 0xFF bytes", pnum); ··· 1345 1363 goto error; 1346 1364 } 1347 1365 1348 - err = check_pattern(ubi->dbg_peb_buf, 0xFF, len); 1366 + err = ubi_check_pattern(ubi->dbg_peb_buf, 0xFF, len); 1349 1367 if (err == 0) { 1350 1368 ubi_err("flash region at PEB %d:%d, length %d does not " 1351 1369 "contain all 0xFF bytes", pnum, offset, len);
+19
drivers/mtd/ubi/misc.c
··· 103 103 if (ubi->beb_rsvd_level < MIN_RESEVED_PEBS) 104 104 ubi->beb_rsvd_level = MIN_RESEVED_PEBS; 105 105 } 106 + 107 + /** 108 + * ubi_check_pattern - check if buffer contains only a certain byte pattern. 109 + * @buf: buffer to check 110 + * @patt: the pattern to check 111 + * @size: buffer size in bytes 112 + * 113 + * This function returns %1 in there are only @patt bytes in @buf, and %0 if 114 + * something else was also found. 115 + */ 116 + int ubi_check_pattern(const void *buf, uint8_t patt, int size) 117 + { 118 + int i; 119 + 120 + for (i = 0; i < size; i++) 121 + if (((const uint8_t *)buf)[i] != patt) 122 + return 0; 123 + return 1; 124 + }
+1
drivers/mtd/ubi/ubi.h
··· 511 511 int length); 512 512 int ubi_check_volume(struct ubi_device *ubi, int vol_id); 513 513 void ubi_calculate_reserved(struct ubi_device *ubi); 514 + int ubi_check_pattern(const void *buf, uint8_t patt, int size); 514 515 515 516 /* eba.c */ 516 517 int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,