flash: Rename erase_flash to flash_erase
Change-Id: I417319aadb2fdbfa2d688bb26b5515d2f9265994
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/flash.c b/flash.c
index 811a25c..0f0b6b5 100644
--- a/flash.c
+++ b/flash.c
@@ -149,14 +149,14 @@
}
/*
- * erase_flash() - Erase the flash
+ * flash_erase() - Erase the flash
* @context: The mbox context pointer
* @offset: The flash offset to erase (bytes)
* @size: The number of bytes to erase
*
* Return: 0 on success otherwise negative error code
*/
-int erase_flash(struct mbox_context *context, uint32_t offset, uint32_t count)
+int flash_erase(struct mbox_context *context, uint32_t offset, uint32_t count)
{
const uint32_t erase_size = 1 << context->erase_size_shift;
struct erase_info_user erase_info = { 0 };
diff --git a/flash.h b/flash.h
index 7566d4b..bd16038 100644
--- a/flash.h
+++ b/flash.h
@@ -15,7 +15,7 @@
uint32_t size);
int flash_set_bytemap(struct mbox_context *context, uint32_t offset,
uint32_t count, uint8_t val);
-int erase_flash(struct mbox_context *context, uint32_t offset, uint32_t count);
+int flash_erase(struct mbox_context *context, uint32_t offset, uint32_t count);
int write_flash(struct mbox_context *context, uint32_t offset, void *buf,
uint32_t count);
diff --git a/mboxd_windows.c b/mboxd_windows.c
index ed87df1..e689b47 100644
--- a/mboxd_windows.c
+++ b/mboxd_windows.c
@@ -217,7 +217,7 @@
* We need to erase the flash from low_mem.flash_offset->
* high_mem.flash_offset + high_mem.size
*/
- rc = erase_flash(context, low_mem.flash_offset,
+ rc = flash_erase(context, low_mem.flash_offset,
(high_mem.flash_offset - low_mem.flash_offset) +
high_mem.size);
if (rc < 0) {
@@ -285,7 +285,7 @@
switch (type) {
case WINDOW_ERASED: /* >= V2 ONLY -> block_size == erasesize */
flash_offset = context->current->flash_offset + offset_bytes;
- rc = erase_flash(context, flash_offset, count_bytes);
+ rc = flash_erase(context, flash_offset, count_bytes);
if (rc < 0) {
MSG_ERR("Couldn't erase flash\n");
return rc;
@@ -305,7 +305,7 @@
flash_offset = context->current->flash_offset + offset_bytes;
/* Erase the flash */
- rc = erase_flash(context, flash_offset, count_bytes);
+ rc = flash_erase(context, flash_offset, count_bytes);
if (rc < 0) {
return rc;
}
diff --git a/test/Makefile.am.include b/test/Makefile.am.include
index 55746a5..4520ce7 100644
--- a/test/Makefile.am.include
+++ b/test/Makefile.am.include
@@ -6,8 +6,8 @@
common.c mtd.c \
%reldir%/tmpf.c
-test_erase_flash_SOURCES = \
- %reldir%/erase_flash.c \
+test_flash_erase_SOURCES = \
+ %reldir%/flash_erase.c \
flash.c \
common.c \
%reldir%/tmpf.c
@@ -100,7 +100,7 @@
check_PROGRAMS += \
%reldir%/sanity \
%reldir%/flash_copy \
- %reldir%/erase_flash \
+ %reldir%/flash_erase \
%reldir%/write_flash \
%reldir%/get_mbox_info_v2 \
%reldir%/reset_state \
diff --git a/test/erase_flash.c b/test/flash_erase.c
similarity index 91%
rename from test/erase_flash.c
rename to test/flash_erase.c
index eae2627..9dfdb05 100644
--- a/test/erase_flash.c
+++ b/test/flash_erase.c
@@ -112,7 +112,7 @@
flash_dev_init(&context);
/* Erase from an unknown state */
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 1);
@@ -124,7 +124,7 @@
n_ioctls = 0;
/* Erase an erased flash */
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 0);
@@ -134,7 +134,7 @@
/* Erase written flash */
rc = write_flash(&context, 0, data, sizeof(data));
assert(rc == 0);
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 1);
@@ -148,7 +148,7 @@
/* Erase the start of flash */
rc = write_flash(&context, 0, data, sizeof(data) - 1);
assert(rc == 0);
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 1);
@@ -162,7 +162,7 @@
/* Erase the end of flash */
rc = write_flash(&context, 1, data, sizeof(data) - 1);
assert(rc == 0);
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 1);
@@ -177,7 +177,7 @@
rc = write_flash(&context, 0, data, 1);
rc = write_flash(&context, 2, data, 1);
assert(rc == 0);
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 2);
@@ -193,7 +193,7 @@
/* Erase the middle of flash */
rc = write_flash(&context, 1, data, 1);
assert(rc == 0);
- rc = erase_flash(&context, 0, sizeof(data));
+ rc = flash_erase(&context, 0, sizeof(data));
assert(rc == 0);
assert(n_ioctls == 1);
diff --git a/vpnor/flash.cpp b/vpnor/flash.cpp
index aff74b5..3b928d4 100644
--- a/vpnor/flash.cpp
+++ b/vpnor/flash.cpp
@@ -101,7 +101,7 @@
return 0;
}
-int erase_flash(struct mbox_context* context, uint32_t offset, uint32_t count)
+int flash_erase(struct mbox_context* context, uint32_t offset, uint32_t count)
{
// No-op
return 0;