summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-07-10 15:32:02 +0000
committerThomas Martitz <kugel@rockbox.org>2009-07-10 15:32:02 +0000
commite7f0c3f39770fbc183d729a1d76f0bebbbc77d2a (patch)
treef1a42cd43a6b6e79a4361b5d243ee9083ccd71bb /firmware/target/arm
parentedfcc10876472e616a241393a4b4c5bbdb7b7aba (diff)
downloadrockbox-e7f0c3f39770fbc183d729a1d76f0bebbbc77d2a.tar.gz
rockbox-e7f0c3f39770fbc183d729a1d76f0bebbbc77d2a.tar.bz2
rockbox-e7f0c3f39770fbc183d729a1d76f0bebbbc77d2a.zip
Rearrange things a bit for less #ifdefs and less duplication.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21744 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index 2766c76e41..c2a621d665 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -344,9 +344,6 @@ static void sd_thread(void)
{
struct queue_event ev;
bool idle_notified = false;
-#ifdef HAVE_HOTSWAP
- int microsd_init;
-#endif
while (1)
{
@@ -357,6 +354,8 @@ static void sd_thread(void)
#ifdef HAVE_HOTSWAP
case SYS_HOTSWAP_INSERTED:
case SYS_HOTSWAP_EXTRACTED:
+ {
+ int microsd_init = 1;
fat_lock(); /* lock-out FAT activity first -
prevent deadlocking via disk_mount that
would cause a reverse-order attempt with
@@ -379,25 +378,23 @@ static void sd_thread(void)
sd_enable(true);
init_pl180_controller(SD_SLOT_AS3525);
microsd_init = sd_init_card(SD_SLOT_AS3525);
- if (microsd_init < 0)
+ if (microsd_init < 0) /* initialisation failed */
panicf("microSD init failed : %d", microsd_init);
- if (!disk_mount(SD_SLOT_AS3525)) /* mount failed */
- {
- /* Access is now safe */
- mutex_unlock(&sd_mtx);
- fat_unlock();
- sd_enable(false);
- break;
- }
+ microsd_init = disk_mount(SD_SLOT_AS3525); /* 0 if fail */
}
- queue_broadcast(SYS_FS_CHANGED, 0);
+ /*
+ * Mount succeeded, or this was an EXTRACTED event,
+ * in both cases notify the system about the additional filesystem
+ if (microsd_init)
+ queue_broadcast(SYS_FS_CHANGED, 0);
/* Access is now safe */
mutex_unlock(&sd_mtx);
fat_unlock();
sd_enable(false);
+ }
break;
#endif
case SYS_TIMEOUT: