summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/misc.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-31 09:37:34 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-19 17:19:57 +0300
commitbb00e180a93a6c8e89c3b2d1f9473781e1e2d2a4 (patch)
tree87bd9ddc65052014e36e4fb0565e73d7ff4dd992 /drivers/mtd/ubi/misc.c
parent0525dac9fd31e5a12fb934238abd09e2752a5967 (diff)
downloadop-kernel-dev-bb00e180a93a6c8e89c3b2d1f9473781e1e2d2a4.zip
op-kernel-dev-bb00e180a93a6c8e89c3b2d1f9473781e1e2d2a4.tar.gz
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 22ad314..ff2a65c 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)
if (ubi->beb_rsvd_level < MIN_RESEVED_PEBS)
ubi->beb_rsvd_level = MIN_RESEVED_PEBS;
}
+
+/**
+ * ubi_check_pattern - check if buffer contains only a certain byte pattern.
+ * @buf: buffer to check
+ * @patt: the pattern to check
+ * @size: buffer size in bytes
+ *
+ * This function returns %1 in there are only @patt bytes in @buf, and %0 if
+ * something else was also found.
+ */
+int ubi_check_pattern(const void *buf, uint8_t patt, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ if (((const uint8_t *)buf)[i] != patt)
+ return 0;
+ return 1;
+}
OpenPOWER on IntegriCloud