aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-01-12 15:25:04 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-13 01:52:24 -0500
commit554b91edec1c588b889a7357ff201c0a450e31ff (patch)
treec400b840e11a9799dc4d3ea4c304ac41cb545e87 /sound
parent199f7978730a4bbd88038fd84212b30759579f1a (diff)
ALSA: sscape: fix incorrect timeout after microcode upload
A comment states that one should wait up to 5 secs while a waiting loop waits only 5 system ticks. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/sscape.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index bc449166d18d..6a7f842b9627 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -393,20 +393,20 @@ static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned ti
393 */ 393 */
394static int obp_startup_ack(struct soundscape *s, unsigned timeout) 394static int obp_startup_ack(struct soundscape *s, unsigned timeout)
395{ 395{
396 while (timeout != 0) { 396 unsigned long end_time = jiffies + msecs_to_jiffies(timeout);
397
398 do {
397 unsigned long flags; 399 unsigned long flags;
398 unsigned char x; 400 unsigned char x;
399 401
400 schedule_timeout_uninterruptible(1);
401
402 spin_lock_irqsave(&s->lock, flags); 402 spin_lock_irqsave(&s->lock, flags);
403 x = inb(HOST_DATA_IO(s->io_base)); 403 x = inb(HOST_DATA_IO(s->io_base));
404 spin_unlock_irqrestore(&s->lock, flags); 404 spin_unlock_irqrestore(&s->lock, flags);
405 if ((x & 0xfe) == 0xfe) 405 if ((x & 0xfe) == 0xfe)
406 return 1; 406 return 1;
407 407
408 --timeout; 408 msleep(10);
409 } /* while */ 409 } while (time_before(jiffies, end_time));
410 410
411 return 0; 411 return 0;
412} 412}
@@ -420,20 +420,20 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout)
420 */ 420 */
421static int host_startup_ack(struct soundscape *s, unsigned timeout) 421static int host_startup_ack(struct soundscape *s, unsigned timeout)
422{ 422{
423 while (timeout != 0) { 423 unsigned long end_time = jiffies + msecs_to_jiffies(timeout);
424
425 do {
424 unsigned long flags; 426 unsigned long flags;
425 unsigned char x; 427 unsigned char x;
426 428
427 schedule_timeout_uninterruptible(1);
428
429 spin_lock_irqsave(&s->lock, flags); 429 spin_lock_irqsave(&s->lock, flags);
430 x = inb(HOST_DATA_IO(s->io_base)); 430 x = inb(HOST_DATA_IO(s->io_base));
431 spin_unlock_irqrestore(&s->lock, flags); 431 spin_unlock_irqrestore(&s->lock, flags);
432 if (x == 0xfe) 432 if (x == 0xfe)
433 return 1; 433 return 1;
434 434
435 --timeout; 435 msleep(10);
436 } /* while */ 436 } while (time_before(jiffies, end_time));
437 437
438 return 0; 438 return 0;
439} 439}
@@ -529,10 +529,10 @@ static int upload_dma_data(struct soundscape *s,
529 * give it 5 seconds (max) ... 529 * give it 5 seconds (max) ...
530 */ 530 */
531 ret = 0; 531 ret = 0;
532 if (!obp_startup_ack(s, 5)) { 532 if (!obp_startup_ack(s, 5000)) {
533 snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n"); 533 snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n");
534 ret = -EAGAIN; 534 ret = -EAGAIN;
535 } else if (!host_startup_ack(s, 5)) { 535 } else if (!host_startup_ack(s, 5000)) {
536 snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n"); 536 snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n");
537 ret = -EAGAIN; 537 ret = -EAGAIN;
538 } 538 }