]> err.no Git - linux-2.6/blobdiff - sound/pci/rme9652/rme9652.c
Merge head 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
[linux-2.6] / sound / pci / rme9652 / rme9652.c
index 5861f234af212cbd44a3a893d25a6847a989fcaa..1bc9d0df8516e27b2a338b6859c1fa0ec63088dc 100644 (file)
@@ -303,18 +303,22 @@ static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer
 {
        dmab->dev.type = SNDRV_DMA_TYPE_DEV;
        dmab->dev.dev = snd_dma_pci_data(pci);
-       if (! snd_dma_get_reserved_buf(dmab, snd_dma_pci_buf_id(pci))) {
-               if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
-                                       size, dmab) < 0)
-                       return -ENOMEM;
+       if (snd_dma_get_reserved_buf(dmab, snd_dma_pci_buf_id(pci))) {
+               if (dmab->bytes >= size)
+                       return 0;
        }
+       if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
+                               size, dmab) < 0)
+               return -ENOMEM;
        return 0;
 }
 
 static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
 {
-       if (dmab->area)
+       if (dmab->area) {
+               dmab->dev.dev = NULL; /* make it anonymous */
                snd_dma_reserve_buf(dmab, snd_dma_pci_buf_id(pci));
+       }
 }
 
 
@@ -1466,7 +1470,7 @@ static int snd_rme9652_get_tc_valid(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu
        return 0;
 }
 
-#if ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE
+#ifdef ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE
 
 /* FIXME: this routine needs a port to the new control API --jk */