diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-03-12 02:50:07 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-03-12 02:50:07 +0000 |
commit | 2f5a37de5c45333453169ffe0b90e0f380d1cd50 (patch) | |
tree | db693867f6a04bf0443a74b1bfc64fe15404f3cd | |
parent | d80246fac010002606d936f6a38057cfa108d172 (diff) | |
download | rockbox-2f5a37de5c45333453169ffe0b90e0f380d1cd50.tar.gz rockbox-2f5a37de5c45333453169ffe0b90e0f380d1cd50.zip |
Fix newly introduced race condition in SD driver. Make sure to force remount in case two SYS_HOTSWAP_INSERTED messages are received in a row. Be sure flags are reset to re-initialize the SD-card. Go back to locking out driver access during disk mount/unmount attempts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16635 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/sandisk/ata-c200_e200.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c index 7a4328df80..150b08fd92 100644 --- a/firmware/target/arm/sandisk/ata-c200_e200.c +++ b/firmware/target/arm/sandisk/ata-c200_e200.c | |||
@@ -1045,13 +1045,22 @@ static void sd_thread(void) | |||
1045 | { | 1045 | { |
1046 | #ifdef HAVE_HOTSWAP | 1046 | #ifdef HAVE_HOTSWAP |
1047 | case SYS_HOTSWAP_INSERTED: | 1047 | case SYS_HOTSWAP_INSERTED: |
1048 | mutex_lock(&sd_mtx); /* Lock-out card activity */ | ||
1049 | card_info[1].initialized = 0; | ||
1050 | sd_status[1].retry = 0; | ||
1051 | disk_unmount(1); /* Force remount */ | ||
1048 | disk_mount(1); /* mount microSD card */ | 1052 | disk_mount(1); /* mount microSD card */ |
1049 | queue_broadcast(SYS_FS_CHANGED, 0); | 1053 | queue_broadcast(SYS_FS_CHANGED, 0); |
1054 | mutex_unlock(&sd_mtx); | ||
1050 | break; | 1055 | break; |
1051 | 1056 | ||
1052 | case SYS_HOTSWAP_EXTRACTED: | 1057 | case SYS_HOTSWAP_EXTRACTED: |
1058 | mutex_lock(&sd_mtx); /* Lock-out card activity */ | ||
1059 | card_info[1].initialized = 0; | ||
1060 | sd_status[1].retry = 0; | ||
1053 | disk_unmount(1); /* release "by force" */ | 1061 | disk_unmount(1); /* release "by force" */ |
1054 | queue_broadcast(SYS_FS_CHANGED, 0); | 1062 | queue_broadcast(SYS_FS_CHANGED, 0); |
1063 | mutex_unlock(&sd_mtx); | ||
1055 | break; | 1064 | break; |
1056 | #endif | 1065 | #endif |
1057 | case SYS_TIMEOUT: | 1066 | case SYS_TIMEOUT: |