From: Takashi Iwai <tiwai@suse.de>
To: linux-media@vger.kernel.org
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: [PATCH for-5.6 09/14] media: go7007: Clean up ALSA PCM API usages
Date: Tue, 10 Dec 2019 14:58:44 +0100 [thread overview]
Message-ID: <20191210135849.15607-10-tiwai@suse.de> (raw)
In-Reply-To: <20191210135849.15607-1-tiwai@suse.de>
With the recent change in ALSA PCM core, the whole open-coded vmalloc
buffer handling in this driver can be dropped by replacing with the
managed buffer allocation.
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/media/usb/go7007/snd-go7007.c | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c
index b05fa227ffb2..40dbf081ef6b 100644
--- a/drivers/media/usb/go7007/snd-go7007.c
+++ b/drivers/media/usb/go7007/snd-go7007.c
@@ -9,7 +9,6 @@
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/sched.h>
-#include <linux/vmalloc.h>
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/i2c.h>
@@ -100,16 +99,7 @@ static int go7007_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct go7007 *go = snd_pcm_substream_chip(substream);
- unsigned int bytes;
-
- bytes = params_buffer_bytes(hw_params);
- if (substream->runtime->dma_bytes > 0)
- vfree(substream->runtime->dma_area);
- substream->runtime->dma_bytes = 0;
- substream->runtime->dma_area = vmalloc(bytes);
- if (substream->runtime->dma_area == NULL)
- return -ENOMEM;
- substream->runtime->dma_bytes = bytes;
+
go->audio_deliver = parse_audio_stream_data;
return 0;
}
@@ -119,9 +109,6 @@ static int go7007_snd_hw_free(struct snd_pcm_substream *substream)
struct go7007 *go = snd_pcm_substream_chip(substream);
go->audio_deliver = NULL;
- if (substream->runtime->dma_bytes > 0)
- vfree(substream->runtime->dma_area);
- substream->runtime->dma_bytes = 0;
return 0;
}
@@ -185,12 +172,6 @@ static snd_pcm_uframes_t go7007_snd_pcm_pointer(struct snd_pcm_substream *substr
return gosnd->hw_ptr;
}
-static struct page *go7007_snd_pcm_page(struct snd_pcm_substream *substream,
- unsigned long offset)
-{
- return vmalloc_to_page(substream->runtime->dma_area + offset);
-}
-
static const struct snd_pcm_ops go7007_snd_capture_ops = {
.open = go7007_snd_capture_open,
.close = go7007_snd_capture_close,
@@ -200,7 +181,6 @@ static const struct snd_pcm_ops go7007_snd_capture_ops = {
.prepare = go7007_snd_pcm_prepare,
.trigger = go7007_snd_pcm_trigger,
.pointer = go7007_snd_pcm_pointer,
- .page = go7007_snd_pcm_page,
};
static int go7007_snd_free(struct snd_device *device)
@@ -260,6 +240,8 @@ int go7007_snd_init(struct go7007 *go)
gosnd->pcm->private_data = go;
snd_pcm_set_ops(gosnd->pcm, SNDRV_PCM_STREAM_CAPTURE,
&go7007_snd_capture_ops);
+ snd_pcm_set_managed_buffer_all(gosnd->pcm, SNDRV_DMA_TYPE_VMALLOC,
+ NULL, 0, 0);
ret = snd_card_register(gosnd->card);
if (ret < 0) {
--
2.16.4
next prev parent reply other threads:[~2019-12-10 13:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 13:58 [PATCH for-5.6 00/14] media: ALSA PCM API updates Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 01/14] media: solo6x10: Use managed buffer allocation Takashi Iwai
2019-12-16 23:42 ` Ismael Luceno
2019-12-10 13:58 ` [PATCH for-5.6 02/14] media: tw686x: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 03/14] media: usbtv: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 04/14] media: cobalt: Clean up ALSA PCM API usages Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 05/14] media: cx18: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 06/14] media: ivtv: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 07/14] media: cs231xx: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 08/14] media: em28xx: " Takashi Iwai
2019-12-10 13:58 ` Takashi Iwai [this message]
2019-12-10 13:58 ` [PATCH for-5.6 10/14] media: tm6000: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 11/14] media: cobalt: Drop superfluous ioctl PCM ops Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 12/14] media: cx18: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 13/14] media: ivtv: " Takashi Iwai
2019-12-10 13:58 ` [PATCH for-5.6 14/14] media: " Takashi Iwai
2019-12-16 23:43 ` Ismael Luceno
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=20191210135849.15607-10-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox