Received: from milmhbs1.lsil.com (147.145.21.209) by coscas01.lsi.com
 (172.21.36.60) with Microsoft SMTP Server id 8.1.393.1; Thu, 26 Nov 2009
 08:15:42 -0700
Received: from mail2.lsil.com (mail2.lsil.com [147.145.40.22])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id nAQFFgBd020571	for
 <andy.sharp@lsi.com>; Thu, 26 Nov 2009 07:15:42 -0800
Received: from psmtp.com (na3sys009amx167.postini.com [74.125.149.93])	by
 mail2.lsil.com (8.12.11/8.12.11) with SMTP id nAQFBaWR006677	for
 <andy.sharp@lsi.com>; Thu, 26 Nov 2009 07:11:36 -0800 (PST)
Received: from source ([78.24.191.182]) by na3sys009amx167.postini.com
 ([74.125.148.14]) with SMTP;	Thu, 26 Nov 2009 07:15:41 PST
Received: from localhost.localdomain ([127.0.0.1]:49935 "EHLO
        eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL)        by
 eddie.linux-mips.org with ESMTP id S1492904AbZKZPPj (ORCPT
        <rfc822;andy.sharp@lsi.com>); Thu, 26 Nov 2009 16:15:39 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 26 Nov 2009 16:15:21
 +0100 (CET)
Received: from cantor.suse.de ([195.135.220.2]:40123 "EHLO mx1.suse.de"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP        id
 S1493717AbZKZPNo (ORCPT <rfc822;linux-mips@linux-mips.org>);        Thu, 26
 Nov 2009 16:13:44 +0100
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))        (No
 client certificate requested)        by mx1.suse.de (Postfix) with ESMTP id
 15BEA90847;        Thu, 26 Nov 2009 16:13:44 +0100 (CET)
From: Takashi Iwai <tiwai@suse.de>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
CC: Ralf Baechle <ralf@linux-mips.org>, Wu Zhangjin <wuzhangjin@gmail.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>, "linux-mips@linux-mips.org"
	<linux-mips@linux-mips.org>, Benjamin Herrenschmidt
	<benh@kernel.crashing.org>, Kumar Gala <galak@gate.crashing.org>, Becky Bruce
	<beckyb@kernel.crashing.org>, Takashi Iwai <tiwai@suse.de>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Thu, 26 Nov 2009 08:13:08 -0700
Subject: [PATCH 5/5] ALSA: Remove old DMA-mmap code from arm/devdma.c
Thread-Topic: [PATCH 5/5] ALSA: Remove old DMA-mmap code from arm/devdma.c
Thread-Index: Acpuq1H/3EsXRZFgSW26Ks/jA2b+GA==
Message-ID: <1259248388-20095-6-git-send-email-tiwai@suse.de>
References: <1259248388-20095-1-git-send-email-tiwai@suse.de>
 <1259248388-20095-2-git-send-email-tiwai@suse.de>
 <1259248388-20095-3-git-send-email-tiwai@suse.de>
 <1259248388-20095-4-git-send-email-tiwai@suse.de>
 <1259248388-20095-5-git-send-email-tiwai@suse.de>
In-Reply-To: <1259248388-20095-5-git-send-email-tiwai@suse.de>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: coscas01.lsi.com
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-scanned-by: MIMEDefang 2.39
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:79.67387/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c 
x-pstn-addresses: from <tiwai@suse.de> [22/1] 
x-pstn-neptune: 0/0/0.00/0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

The call of dma_mmap_coherent() is done in the PCM core now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/arm/Makefile |    2 +-
 sound/arm/aaci.c   |   16 +++-------
 sound/arm/devdma.c |   80 ------------------------------------------------=
----
 sound/arm/devdma.h |    3 --
 4 files changed, 6 insertions(+), 95 deletions(-)
 delete mode 100644 sound/arm/devdma.c
 delete mode 100644 sound/arm/devdma.h

diff --git a/sound/arm/Makefile b/sound/arm/Makefile
index 5a549ed..8c0c851 100644
--- a/sound/arm/Makefile
+++ b/sound/arm/Makefile
@@ -3,7 +3,7 @@
 #
=20
 obj-$(CONFIG_SND_ARMAACI)	+=3D snd-aaci.o
-snd-aaci-objs			:=3D aaci.o devdma.o
+snd-aaci-objs			:=3D aaci.o
=20
 obj-$(CONFIG_SND_PXA2XX_PCM)	+=3D snd-pxa2xx-pcm.o
 snd-pxa2xx-pcm-objs		:=3D pxa2xx-pcm.o
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1f0f821..e593728 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -30,7 +30,6 @@
 #include <sound/pcm_params.h>
=20
 #include "aaci.h"
-#include "devdma.h"
=20
 #define DRIVER_NAME	"aaci-pl041"
=20
@@ -492,7 +491,7 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *s=
ubstream)
 	/*
 	 * Clear out the DMA and any allocated buffers.
 	 */
-	devdma_hw_free(NULL, substream);
+	snd_pcm_lib_free_pages(substream);
=20
 	return 0;
 }
@@ -505,8 +504,8 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream =
*substream,
=20
 	aaci_pcm_hw_free(substream);
=20
-	err =3D devdma_hw_alloc(NULL, substream,
-			      params_buffer_bytes(params));
+	err =3D snd_pcm_lib_malloc_pages(substream,
+				       params_buffer_bytes(params));
 	if (err < 0)
 		goto out;
=20
@@ -551,11 +550,6 @@ static snd_pcm_uframes_t aaci_pcm_pointer(struct snd_p=
cm_substream *substream)
 	return bytes_to_frames(runtime, bytes);
 }
=20
-static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_ar=
ea_struct *vma)
-{
-	return devdma_mmap(NULL, substream, vma);
-}
-
=20
 /*
  * Playback specific ALSA stuff
@@ -722,7 +716,6 @@ static struct snd_pcm_ops aaci_playback_ops =3D {
 	.prepare	=3D aaci_pcm_prepare,
 	.trigger	=3D aaci_pcm_playback_trigger,
 	.pointer	=3D aaci_pcm_pointer,
-	.mmap		=3D aaci_pcm_mmap,
 };
=20
 static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
@@ -850,7 +843,6 @@ static struct snd_pcm_ops aaci_capture_ops =3D {
 	.prepare	=3D aaci_pcm_capture_prepare,
 	.trigger	=3D aaci_pcm_capture_trigger,
 	.pointer	=3D aaci_pcm_pointer,
-	.mmap		=3D aaci_pcm_mmap,
 };
=20
 /*
@@ -1040,6 +1032,8 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
=20
 		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
 		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
+		snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+						      NULL, 0, 64 * 104);
 	}
=20
 	return ret;
diff --git a/sound/arm/devdma.c b/sound/arm/devdma.c
deleted file mode 100644
index 9d1e666..0000000
--- a/sound/arm/devdma.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  linux/sound/arm/devdma.c
- *
- *  Copyright (C) 2003-2004 Russell King, All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ARM DMA shim for ALSA.
- */
-#include <linux/device.h>
-#include <linux/dma-mapping.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-
-#include "devdma.h"
-
-void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substrea=
m)
-{
-	struct snd_pcm_runtime *runtime =3D substream->runtime;
-	struct snd_dma_buffer *buf =3D runtime->dma_buffer_p;
-
-	if (runtime->dma_area =3D=3D NULL)
-		return;
-
-	if (buf !=3D &substream->dma_buffer) {
-		dma_free_coherent(buf->dev.dev, buf->bytes, buf->area, buf->addr);
-		kfree(runtime->dma_buffer_p);
-	}
-
-	snd_pcm_set_runtime_buffer(substream, NULL);
-}
-
-int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substrea=
m, size_t size)
-{
-	struct snd_pcm_runtime *runtime =3D substream->runtime;
-	struct snd_dma_buffer *buf =3D runtime->dma_buffer_p;
-	int ret =3D 0;
-
-	if (buf) {
-		if (buf->bytes >=3D size)
-			goto out;
-		devdma_hw_free(dev, substream);
-	}
-
-	if (substream->dma_buffer.area !=3D NULL && substream->dma_buffer.bytes >=
=3D size) {
-		buf =3D &substream->dma_buffer;
-	} else {
-		buf =3D kmalloc(sizeof(struct snd_dma_buffer), GFP_KERNEL);
-		if (!buf)
-			goto nomem;
-
-		buf->dev.type =3D SNDRV_DMA_TYPE_DEV;
-		buf->dev.dev =3D dev;
-		buf->area =3D dma_alloc_coherent(dev, size, &buf->addr, GFP_KERNEL);
-		buf->bytes =3D size;
-		buf->private_data =3D NULL;
-
-		if (!buf->area)
-			goto free;
-	}
-	snd_pcm_set_runtime_buffer(substream, buf);
-	ret =3D 1;
- out:
-	runtime->dma_bytes =3D size;
-	return ret;
-
- free:
-	kfree(buf);
- nomem:
-	return -ENOMEM;
-}
-
-int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, s=
truct vm_area_struct *vma)
-{
-	struct snd_pcm_runtime *runtime =3D substream->runtime;
-	return dma_mmap_coherent(dev, vma, runtime->dma_area, runtime->dma_addr, =
runtime->dma_bytes);
-}
diff --git a/sound/arm/devdma.h b/sound/arm/devdma.h
deleted file mode 100644
index d025329..0000000
--- a/sound/arm/devdma.h
+++ /dev/null
@@ -1,3 +0,0 @@
-void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substrea=
m);
-int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substrea=
m, size_t size);
-int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, s=
truct vm_area_struct *vma);
--=20
1.6.5.3


