Skip to contentSkip to conversation

fix ALSA compilation on Sparc32

PATCH In review Markus Dahms 3 participants 4 messages Aug 30, 2007 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix ALSA compilation on Sparc32

The dma_alloc_coherent and dma_free_coherent function seem to be not available on sparc(32) architecture. It is not used by SBus sound drivers, so it's disabled via #ifndef for CONFIG_SPARC32.

---
It is tested on a SparcStation 5 with the cs4231 driver. The ALSA list should have been CCed, but as it is subscriber-only I skipped it.

sound/core/memalloc.c.patched renamed from sound/core/memalloc.c +8 -0
@@ -205,6 +205,8 @@ void snd_free_pages(void *ptr, size_t si
  *
  */
 
+#ifndef CONFIG_SPARC32
+
 /* allocate the coherent DMA pages */
 static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma)
 {
@@ -239,6 +241,8 @@ static void snd_free_dev_pages(struct de
 	dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma);
 }
 
+#endif
+
 #ifdef CONFIG_SBUS
 
 static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
@@ -311,9 +315,11 @@ int snd_dma_alloc_pages(int type, struct
 		dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
 		break;
 #endif
+#ifndef CONFIG_SPARC32
 	case SNDRV_DMA_TYPE_DEV:
 		dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
 		break;
+#endif
 	case SNDRV_DMA_TYPE_DEV_SG:
 		snd_malloc_sgbuf_pages(device, size, dmab, NULL);
 		break;
@@ -382,9 +388,11 @@ void snd_dma_free_pages(struct snd_dma_b
 		snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
 		break;
 #endif
+#ifndef CONFIG_SPARC32
 	case SNDRV_DMA_TYPE_DEV:
 		snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
 		break;
+#endif
 	case SNDRV_DMA_TYPE_DEV_SG:
 		snd_free_sgbuf_pages(dmab);
 		break;
#1 lore raw
Quoted 3 lines · On Thu, 30 Aug 2007 11:26:04 +0200 Markus Dahms <[email protected]> wrote:

The dma_alloc_coherent and dma_free_coherent function seem to be not available on sparc(32) architecture. It is not used by SBus sound drivers, so it's disabled via #ifndef for CONFIG_SPARC32.

It would probably look a lot cleaner if you either provided dummy dma_alloc_coherent/free coherent inlines for SPARC32, fixed it (if sparc32 can do coherent DMA) or if you must ifdef it provide dummy functions in the memalloc code so its a single ifdef

#2 lore raw

At Thu, 30 Aug 2007 11:09:39 +0100,

Quoted 4 lines · Alan Cox

On Thu, 30 Aug 2007 11:26:04 +0200
Markus Dahms <[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines

The dma_alloc_coherent and dma_free_coherent function seem to be not available on sparc(32) architecture. It is not used by SBus sound drivers, so it's disabled via #ifndef for CONFIG_SPARC32.

It would probably look a lot cleaner if you either provided dummy dma_alloc_coherent/free coherent inlines for SPARC32, fixed it (if sparc32 can do coherent DMA) or if you must ifdef it provide dummy functions in the memalloc code so its a single ifdef

It's been indeed inline on 2.6.22 or ealier in include/asm-generic/dma-mapping.h, but it's changed to extern without defining functions.

I don't think it's a good idea to have function declarations even though we surely know that there are no real function definitions...

Takashi

#3 lore raw
In reply to Markus Dahms

At Thu, 30 Aug 2007 11:26:04 +0200,

Quoted 6 lines · Markus Dahms

The dma_alloc_coherent and dma_free_coherent function seem to be not available on sparc(32) architecture. It is not used by SBus sound drivers, so it's disabled via #ifndef for CONFIG_SPARC32.

Actually, the fix has been in ALSA tree (found in git-alsa.patch in mm tree) since long time ago, but it was never pushed.

Jaroslav, could you push the fixes please...?

thanks,

Takashi