aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/misc.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-31 02:37:34 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-19 10:19:57 -0400
commitbb00e180a93a6c8e89c3b2d1f9473781e1e2d2a4 (patch)
tree87bd9ddc65052014e36e4fb0565e73d7ff4dd992 /drivers/mtd/ubi/misc.c
parent0525dac9fd31e5a12fb934238abd09e2752a5967 (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/misc.c')
-rw-r--r--drivers/mtd/ubi/misc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c
index 22ad31402945..ff2a65c37f69 100644
--- a/drivers/mtd/ubi/misc.c
+++ b/drivers/mtd/ubi/misc.c
@@ -103,3 +103,22 @@ void ubi_calculate_reserved(struct ubi_device *ubi)
103 if (ubi->beb_rsvd_level < MIN_RESEVED_PEBS) 103 if (ubi->beb_rsvd_level < MIN_RESEVED_PEBS)
104 ubi->beb_rsvd_level = MIN_RESEVED_PEBS; 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 */
116int 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}