From: Takashi Iwai <tiwai@suse.de>
To: linux-media@vger.kernel.org
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: [PATCH for-5.6 03/14] media: usbtv: Use managed buffer allocation
Date: Tue, 10 Dec 2019 14:58:38 +0100 [thread overview]
Message-ID: <20191210135849.15607-4-tiwai@suse.de> (raw)
In-Reply-To: <20191210135849.15607-1-tiwai@suse.de>
Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and dropped.
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/media/usb/usbtv/usbtv-audio.c | 28 +---------------------------
1 file changed, 1 insertion(+), 27 deletions(-)
diff --git a/drivers/media/usb/usbtv/usbtv-audio.c b/drivers/media/usb/usbtv/usbtv-audio.c
index e746c8ddfc49..b27009875758 100644
--- a/drivers/media/usb/usbtv/usbtv-audio.c
+++ b/drivers/media/usb/usbtv/usbtv-audio.c
@@ -85,30 +85,6 @@ static int snd_usbtv_pcm_close(struct snd_pcm_substream *substream)
return 0;
}
-static int snd_usbtv_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *hw_params)
-{
- int rv;
- struct usbtv *chip = snd_pcm_substream_chip(substream);
-
- rv = snd_pcm_lib_malloc_pages(substream,
- params_buffer_bytes(hw_params));
-
- if (rv < 0) {
- dev_warn(chip->dev, "pcm audio buffer allocation failure %i\n",
- rv);
- return rv;
- }
-
- return 0;
-}
-
-static int snd_usbtv_hw_free(struct snd_pcm_substream *substream)
-{
- snd_pcm_lib_free_pages(substream);
- return 0;
-}
-
static int snd_usbtv_prepare(struct snd_pcm_substream *substream)
{
struct usbtv *chip = snd_pcm_substream_chip(substream);
@@ -337,8 +313,6 @@ static const struct snd_pcm_ops snd_usbtv_pcm_ops = {
.open = snd_usbtv_pcm_open,
.close = snd_usbtv_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
- .hw_params = snd_usbtv_hw_params,
- .hw_free = snd_usbtv_hw_free,
.prepare = snd_usbtv_prepare,
.trigger = snd_usbtv_card_trigger,
.pointer = snd_usbtv_pointer,
@@ -377,7 +351,7 @@ int usbtv_audio_init(struct usbtv *usbtv)
pcm->private_data = usbtv;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usbtv_pcm_ops);
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
NULL, USBTV_AUDIO_BUFFER, USBTV_AUDIO_BUFFER);
rv = snd_card_register(card);
--
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 ` Takashi Iwai [this message]
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 ` [PATCH for-5.6 09/14] media: go7007: " Takashi Iwai
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-4-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--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