summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2009-10-10 10:51:07 +0000
committerMichael Sparmann <theseven@rockbox.org>2009-10-10 10:51:07 +0000
commit51b00c9b0b3dce33daf5ecefcd7e04145decda39 (patch)
tree316aeac4ccde389f2515e883f43a5982087944ef /firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
parent46a0db45dd2436442f3679b21b7cf631358be585 (diff)
downloadrockbox-51b00c9b0b3dce33daf5ecefcd7e04145decda39.tar.gz
rockbox-51b00c9b0b3dce33daf5ecefcd7e04145decda39.zip
Fixed some mutex issues in the iPod Nano 2G NAND driver and FTL.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23066 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
index e4abcafba8..15c97ccb0d 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
@@ -1778,6 +1778,8 @@ uint32_t ftl_sync(void)
uint32_t ppb = (*ftl_nand_type).pagesperblock * ftl_banks;
if (ftl_cxt.clean_flag == 1) return 0;
+ mutex_lock(&ftl_mtx);
+
if (ftl_cxt.swapcounter >= 20)
for (i = 0; i < 4; i++)
if (ftl_swap_blocks() == 0)
@@ -1793,10 +1795,19 @@ uint32_t ftl_sync(void)
rc |= ftl_commit_sequential(&ftl_log[i]);
else rc |= ftl_commit_scattered(&ftl_log[i]);
}
- if (rc != 0) return 1;
+ if (rc != 0)
+ {
+ mutex_unlock(&ftl_mtx);
+ return 1;
+ }
for (i = 0; i < 5; i++)
- if (ftl_commit_cxt() == 0) return 0;
+ if (ftl_commit_cxt() == 0)
+ {
+ mutex_unlock(&ftl_mtx);
+ return 0;
+ }
else ftl_cxt.ftlctrlpage |= ppb - 1;
+ mutex_unlock(&ftl_mtx);
return 1;
}
#endif