From: Takashi Iwai <tiwai@suse.de>
To: Russell King <rmk+alsa@arm.linux.org.uk>
Cc: Jaroslav Kysela <perex@suse.cz>,
Alsa Devel list <alsa-devel@lists.sourceforge.net>
Subject: Re: [PATCH] 1/3 Implement generic device DMA mapping support
Date: Tue, 02 Mar 2004 15:38:28 +0100 [thread overview]
Message-ID: <s5h65dnfh5n.wl@alsa2.suse.de> (raw)
In-Reply-To: <20040302142632.A12353@flint.arm.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 512 bytes --]
At Tue, 2 Mar 2004 14:26:32 +0000,
Russell King wrote:
>
> I, therefore, suggest that you're not looking at a 2.6.3 kernel. This
> was changed from pci_alloc_consistent to dma_alloc_coherent on 22 Dec,
> and was modified to take the GFP flags on 13 Jan.
>
> dma_alloc_coherent() is therefore not a wrapper for pci_alloc_consistent().
sorry, my bad. forget my last post...
BTW, there are some typos in your patches, and missing replacement of
PCI -> DEV dma type. the attached patch should fix.
Takashi
[-- Attachment #2: Type: text/plain, Size: 3801 bytes --]
--- linux/sound/core/memalloc.c 2004-03-02 15:33:38.628633893 +0100
+++ linux/sound/core/memalloc.c 2004-03-02 15:14:15.000000000 +0100
@@ -94,28 +94,28 @@
*/
static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,
- dma_addr_t *dma_handle)
+ dma_addr_t *dma_handle, int gfp_flags)
{
void *ret;
u64 dma_mask;
if (dev == NULL)
- return dev_alloc_coherent(dev, size, dma_handle);
- dma_mask = dev->dma_mask;
- dev->dma_mask = 0xffffffff; /* do without masking */
- ret = dev_alloc_coherent(dev, size, dma_handle, GFP_KERNEL);
- dev->dma_mask = dma_mask; /* restore */
+ return dma_alloc_coherent(dev, size, dma_handle, gfp_flags);
+ dma_mask = *dev->dma_mask;
+ *dev->dma_mask = 0xffffffff; /* do without masking */
+ ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags);
+ *dev->dma_mask = dma_mask; /* restore */
if (ret) {
/* obtained address is out of range? */
if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {
/* reallocate with the proper mask */
dma_free_coherent(dev, size, ret, *dma_handle);
- ret = dma_alloc_coherent(dev, size, dma_handle, GFP_KERNEL);
+ ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags);
}
} else {
/* wish to success now with the proper mask... */
if (dma_mask != 0xffffffffUL)
- ret = dma_alloc_coherent(dev, size, dma_handle, GFP_KERNEL);
+ ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags);
}
return ret;
}
--- linux/sound/pci/emu10k1/memory.c 15 Jan 2004 16:43:09 -0000 1.11
+++ linux/sound/pci/emu10k1/memory.c 2 Mar 2004 14:14:57 -0000
@@ -297,7 +297,7 @@
int page, err, idx;
snd_assert(emu, return NULL);
- snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG, return NULL);
+ snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG, return NULL);
snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes < MAXPAGES * EMUPAGESIZE, return NULL);
hdr = emu->memhdr;
snd_assert(hdr, return NULL);
--- linux/sound/pci/trident/trident_main.c 24 Feb 2004 11:46:57 -0000 1.48
+++ linux/sound/pci/trident/trident_main.c 2 Mar 2004 14:15:55 -0000
@@ -1009,7 +1009,7 @@
snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data;
unsigned int val, ESO_bytes;
- snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI, return -EIO);
+ snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV, return -EIO);
spin_lock(&trident->reg_lock);
--- linux/sound/pci/trident/trident_memory.c 10 Mar 2003 13:02:27 -0000 1.9
+++ linux/sound/pci/trident/trident_memory.c 2 Mar 2004 14:16:33 -0000
@@ -191,7 +191,7 @@
int idx, page;
struct snd_sg_buf *sgbuf = runtime->dma_private;
- snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG, return NULL);
+ snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG, return NULL);
snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL);
hdr = trident->tlb.memhdr;
snd_assert(hdr != NULL, return NULL);
@@ -240,7 +240,7 @@
dma_addr_t addr;
unsigned long ptr;
- snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI, return NULL);
+ snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV, return NULL);
snd_assert(runtime->dma_bytes> 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL);
hdr = trident->tlb.memhdr;
snd_assert(hdr != NULL, return NULL);
@@ -276,7 +276,7 @@
{
snd_assert(trident != NULL, return NULL);
snd_assert(substream != NULL, return NULL);
- if (substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG)
+ if (substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG)
return snd_trident_alloc_sg_pages(trident, substream);
else
return snd_trident_alloc_cont_pages(trident, substream);
next prev parent reply other threads:[~2004-03-02 14:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-29 22:38 [PATCH] 1/3 Implement generic device DMA mapping support Russell King
2004-02-29 22:42 ` [PATCH] 2/3 " Russell King
2004-02-29 22:43 ` [PATCH] 3/3 " Russell King
2004-03-01 15:41 ` [PATCH] 1/3 " Takashi Iwai
2004-03-01 15:38 ` Jaroslav Kysela
2004-03-01 17:45 ` Russell King
2004-03-01 17:51 ` Takashi Iwai
2004-03-01 18:22 ` Russell King
2004-03-01 18:34 ` Takashi Iwai
2004-03-01 18:44 ` Takashi Iwai
2004-03-02 15:23 ` Takashi Iwai
2004-03-02 14:09 ` Takashi Iwai
2004-03-02 14:26 ` Russell King
2004-03-02 14:38 ` Takashi Iwai [this message]
2004-03-02 14:55 ` Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h65dnfh5n.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=perex@suse.cz \
--cc=rmk+alsa@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.