diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-03-12 10:03:52 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-03-12 10:03:52 +0000 |
commit | 06a5299aff38ba25c7742ae6293c588e38445f8b (patch) | |
tree | 5f8c3121882ba9c8d6317d1ce7fb5a07d3a99f5c /firmware/drivers | |
parent | 2f5a37de5c45333453169ffe0b90e0f380d1cd50 (diff) |
Do some crackdown on kernel object reinitialization after they could be in use and use before initialization. For c200/e200: Be sure fat cache and ata locks are acquired in the proper order during hot swapping. Delay hotswap monitoring until after initial file mounting (address 2nd kobj concern + possible call of fat driver before init).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16636 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/audio/as3514.c | 3 | ||||
-rw-r--r-- | firmware/drivers/fat.c | 19 |
2 files changed, 18 insertions, 4 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 08d4d538a4..d51341d8c3 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -132,9 +132,6 @@ void audiohw_init(void) { unsigned int i; - /* reset I2C */ - i2c_init(); - /* normal outputs for CDI and I2S pin groups */ DEV_INIT2 &= ~0x300; diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 9dd27cf72a..f3374fc4c4 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -172,6 +172,7 @@ struct bpb }; static struct bpb fat_bpbs[NUM_VOLUMES]; /* mounted partition info */ +static bool initialized = false; static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb)); static int flush_fat(IF_MV_NONVOID(struct bpb* fat_bpb)); @@ -202,6 +203,18 @@ static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE]; static struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; static struct mutex cache_mutex NOCACHEBSS_ATTR; +#ifdef HAVE_HOTSWAP +void fat_lock(void) +{ + mutex_lock(&cache_mutex); +} + +void fat_unlock(void) +{ + mutex_unlock(&cache_mutex); +} +#endif + static long cluster2sec(IF_MV2(struct bpb* fat_bpb,) long cluster) { #ifndef HAVE_MULTIVOLUME @@ -240,7 +253,11 @@ void fat_init(void) { unsigned int i; - mutex_init(&cache_mutex); + if (!initialized) + { + initialized = true; + mutex_init(&cache_mutex); + } /* mark the FAT cache as unused */ for(i = 0;i < FAT_CACHE_SIZE;i++) |