diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-09-11 16:53:53 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-09-11 16:53:53 +0000 |
commit | 358266a94056332af41344ebeec42ec2c6788ad3 (patch) | |
tree | 486ff53d686040536a2f9c161e5e5b9621c9a959 /package/fonera-mp3-drv | |
parent | 642f6014160a8d35931aa6a4c8411cc3bdb2ca88 (diff) |
fix a possible dead lock in the fonera-mp3 driver, that can happen, when the buffer runs dry
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8753 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/fonera-mp3-drv')
-rw-r--r-- | package/fonera-mp3-drv/src/mp3_drv.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/package/fonera-mp3-drv/src/mp3_drv.c b/package/fonera-mp3-drv/src/mp3_drv.c index 9609444181..a2d8c79ae6 100644 --- a/package/fonera-mp3-drv/src/mp3_drv.c +++ b/package/fonera-mp3-drv/src/mp3_drv.c @@ -101,11 +101,12 @@ static DECLARE_COMPLETION(mp3_exit); static int mp3_playback_thread(void *data){ int j; unsigned long timeout; + unsigned char empty = 0; printk("started kthread\n"); daemonize("kmp3"); while(mp3_buffering_status != MP3_PLAY_FINISHED){ if((mp3_buffering_status == MP3_PLAYING) || (mp3_buffering_status == MP3_BUFFER_FINISHED)){ - while(VS1011_NEEDS_DATA){ + while((VS1011_NEEDS_DATA) && (!empty)){ if(mp3_buffer_offset_read == MP3_BUFFER_SIZE){ mp3_buffer_offset_read = 0; } @@ -115,6 +116,7 @@ static int mp3_playback_thread(void *data){ printk("mp3_drv.ko : finished playing\n"); mp3_buffering_status = MP3_PLAY_FINISHED; } else { + empty = 1; printk("mp3_drv.ko : buffer empty ?\n"); if(mp3_buffering_status != MP3_PLAY_FINISHED){ } @@ -128,8 +130,9 @@ static int mp3_playback_thread(void *data){ } } } + empty = 0; timeout = 1; - timeout = wait_event_interruptible_timeout(wq, (timeout==0), timeout); + timeout = wait_event_interruptible_timeout(wq, (timeout==0), timeout); } complete_and_exit(&mp3_exit, 0); } |