mqueue: remove unneeded info->messages initialization
[safe/jmp/linux-2.6] / sound / core / isadma.c
index d523987..950e19b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ISA DMA support functions
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,6 @@
 
 #undef HAVE_REALLY_SLOW_DMA_CONTROLLER
 
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <asm/dma.h>
 
@@ -86,16 +85,24 @@ EXPORT_SYMBOL(snd_dma_disable);
 unsigned int snd_dma_pointer(unsigned long dma, unsigned int size)
 {
        unsigned long flags;
-       unsigned int result;
+       unsigned int result, result1;
 
        flags = claim_dma_lock();
        clear_dma_ff(dma);
        if (!isa_dma_bridge_buggy)
                disable_dma(dma);
        result = get_dma_residue(dma);
+       /*
+        * HACK - read the counter again and choose higher value in order to
+        * avoid reading during counter lower byte roll over if the
+        * isa_dma_bridge_buggy is set.
+        */
+       result1 = get_dma_residue(dma);
        if (!isa_dma_bridge_buggy)
                enable_dma(dma);
        release_dma_lock(flags);
+       if (unlikely(result < result1))
+               result = result1;
 #ifdef CONFIG_SND_DEBUG
        if (result > size)
                snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size);