summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-07-20 13:23:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-07-20 13:23:28 +0000
commit3e1b9d5fdd73d97b3be5043f2cfa2176c1d441a1 (patch)
tree4be6aeb66ad8b1e832177898d1604ade338850aa
parent8e7f9fe595818939ddd3ce12d946c5d795cbb071 (diff)
downloadrockbox-3e1b9d5fdd73d97b3be5043f2cfa2176c1d441a1.tar.gz
rockbox-3e1b9d5fdd73d97b3be5043f2cfa2176c1d441a1.zip
take first_drive into account when handling hotswap. This is not important as long as this is the only driver in use, but it avoids bugs as soon as things like ramdisks are used
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21980 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/ata-sd-pp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index 77d3c3dc31..f963e0ac48 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -180,6 +180,8 @@ static const char sd_thread_name[] = "ata/sd";
static struct mutex sd_mtx SHAREDBSS_ATTR;
static struct event_queue sd_queue;
+static int sd_first_drive = 0;
+
/* Posted when card plugged status has changed */
#define SD_HOTSWAP 1
/* Actions taken by sd_thread when card status has changed */
@@ -1108,9 +1110,9 @@ static void sd_thread(void)
/* We now have exclusive control of fat cache and ata */
- disk_unmount(1); /* release "by force", ensure file
- descriptors aren't leaked and any busy
- ones are invalid if mounting */
+ disk_unmount(sd_first_drive+1); /* release "by force", ensure file
+ descriptors aren't leaked and any busy
+ ones are invalid if mounting */
/* Force card init for new card, re-init for re-inserted one or
* clear if the last attempt to init failed with an error. */
@@ -1118,7 +1120,7 @@ static void sd_thread(void)
sd_status[1].retry = 0;
if (ev.id == SYS_HOTSWAP_INSERTED)
- disk_mount(1);
+ disk_mount(sd_first_drive+1);
queue_broadcast(SYS_FS_CHANGED, 0);
@@ -1350,8 +1352,8 @@ bool sd_present(IF_MD_NONVOID(int drive))
#ifdef CONFIG_STORAGE_MULTI
int sd_num_drives(int first_drive)
{
- /* We don't care which logical drive number(s) we have been assigned */
- (void)first_drive;
+ /* Store which logical drive number(s) we have been assigned */
+ sd_first_drive = first_drive;
#ifdef HAVE_MULTIDRIVE
return 2;