diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2008-01-20 12:44:13 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2008-01-20 12:44:13 +0000 |
| commit | 9e93b9e30a524f7ca787b1198d572a9f36da080e (patch) | |
| tree | d17fa6a5d4d91a84504fd19e239b578bca238bf4 | |
| parent | 45f733e12b1f6c631949638964f4c325a153be3b (diff) | |
| download | rockbox-9e93b9e30a524f7ca787b1198d572a9f36da080e.zip rockbox-9e93b9e30a524f7ca787b1198d572a9f36da080e.tar.gz rockbox-9e93b9e30a524f7ca787b1198d572a9f36da080e.tar.bz2 rockbox-9e93b9e30a524f7ca787b1198d572a9f36da080e.tar.xz | |
Proper mutexing in the MMC driver's ata_init(), resembling what is done in the ata driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16116 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/ata_mmc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 604d1dd..6d69501 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -1117,8 +1117,12 @@ int ata_init(void) { int rc = 0; - mutex_init(&mmc_mutex); - + if (!initialized) + { + mutex_init(&mmc_mutex); + queue_init(&mmc_queue, true); + } + mutex_lock(&mmc_mutex); led(false); /* Port setup */ @@ -1151,7 +1155,6 @@ int ata_init(void) if (!last_mmc_status) mmc_status = MMC_UNTOUCHED; - queue_init(&mmc_queue, true); create_thread(mmc_thread, mmc_stack, sizeof(mmc_stack), 0, mmc_thread_name IF_PRIO(, PRIORITY_SYSTEM) @@ -1160,6 +1163,7 @@ int ata_init(void) initialized = true; } + mutex_unlock(&mmc_mutex); return rc; } |