[dev] flash: Split up flash_init and set_ptable into separate functions.
Update the users of this function.
Signed-off-by: Dima Zavin <dima@android.com>
diff --git a/include/dev/flash.h b/include/dev/flash.h
index 2590d3c..9d55b86 100644
--- a/include/dev/flash.h
+++ b/include/dev/flash.h
@@ -32,8 +32,9 @@
#include <lib/ptable.h>
-void flash_init(struct ptable *ptable);
+void flash_init(void);
struct ptable *flash_get_ptable(void);
+void flash_set_ptable(struct ptable *ptable);
/* flash operations */
int flash_erase(struct ptentry *ptn);
diff --git a/platform/msm_shared/nand.c b/platform/msm_shared/nand.c
index a9a8e69..4447a1b 100644
--- a/platform/msm_shared/nand.c
+++ b/platform/msm_shared/nand.c
@@ -495,11 +495,9 @@
static struct ptable *flash_ptable = NULL;
-void flash_init(struct ptable *new_ptable)
+void flash_init(void)
{
- ASSERT(flash_ptable == NULL && new_ptable != NULL);
-
- flash_ptable = new_ptable;
+ ASSERT(flash_ptable == NULL);
flash_ptrlist = memalign(32, 1024);
flash_cmdlist = memalign(32, 1024);
@@ -519,6 +517,12 @@
return flash_ptable;
}
+void flash_set_ptable(struct ptable *new_ptable)
+{
+ ASSERT(flash_ptable == NULL && new_ptable != NULL);
+ flash_ptable = new_ptable;
+}
+
int flash_erase(struct ptentry *ptn)
{
unsigned block = ptn->start;
diff --git a/target/surf-msm7k/init.c b/target/surf-msm7k/init.c
index 63cb1a2..e671747 100644
--- a/target/surf-msm7k/init.c
+++ b/target/surf-msm7k/init.c
@@ -91,6 +91,8 @@
ptable_init(&flash_ptable);
smem_ptable_init();
+ flash_init();
+
offset = smem_get_apps_flash_start();
if (offset == 0xffffffff)
offset = BOARD_FLASH_OFFSET;
@@ -101,6 +103,5 @@
}
ptable_dump(&flash_ptable);
-
- flash_init(&flash_ptable);
+ flash_set_ptable(&flash_ptable);
}
diff --git a/target/surf-qsd8k/init.c b/target/surf-qsd8k/init.c
index 63cb1a2..e671747 100644
--- a/target/surf-qsd8k/init.c
+++ b/target/surf-qsd8k/init.c
@@ -91,6 +91,8 @@
ptable_init(&flash_ptable);
smem_ptable_init();
+ flash_init();
+
offset = smem_get_apps_flash_start();
if (offset == 0xffffffff)
offset = BOARD_FLASH_OFFSET;
@@ -101,6 +103,5 @@
}
ptable_dump(&flash_ptable);
-
- flash_init(&flash_ptable);
+ flash_set_ptable(&flash_ptable);
}