hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/usb/go7007/snd-go7007.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2005-2006 Micronas USA Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License (Version 2) as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/kernel.h>
....@@ -17,7 +9,6 @@
179 #include <linux/spinlock.h>
1810 #include <linux/delay.h>
1911 #include <linux/sched.h>
20
-#include <linux/vmalloc.h>
2112 #include <linux/time.h>
2213 #include <linux/mm.h>
2314 #include <linux/i2c.h>
....@@ -108,16 +99,7 @@
10899 struct snd_pcm_hw_params *hw_params)
109100 {
110101 struct go7007 *go = snd_pcm_substream_chip(substream);
111
- unsigned int bytes;
112102
113
- bytes = params_buffer_bytes(hw_params);
114
- if (substream->runtime->dma_bytes > 0)
115
- vfree(substream->runtime->dma_area);
116
- substream->runtime->dma_bytes = 0;
117
- substream->runtime->dma_area = vmalloc(bytes);
118
- if (substream->runtime->dma_area == NULL)
119
- return -ENOMEM;
120
- substream->runtime->dma_bytes = bytes;
121103 go->audio_deliver = parse_audio_stream_data;
122104 return 0;
123105 }
....@@ -127,9 +109,6 @@
127109 struct go7007 *go = snd_pcm_substream_chip(substream);
128110
129111 go->audio_deliver = NULL;
130
- if (substream->runtime->dma_bytes > 0)
131
- vfree(substream->runtime->dma_area);
132
- substream->runtime->dma_bytes = 0;
133112 return 0;
134113 }
135114
....@@ -193,22 +172,14 @@
193172 return gosnd->hw_ptr;
194173 }
195174
196
-static struct page *go7007_snd_pcm_page(struct snd_pcm_substream *substream,
197
- unsigned long offset)
198
-{
199
- return vmalloc_to_page(substream->runtime->dma_area + offset);
200
-}
201
-
202175 static const struct snd_pcm_ops go7007_snd_capture_ops = {
203176 .open = go7007_snd_capture_open,
204177 .close = go7007_snd_capture_close,
205
- .ioctl = snd_pcm_lib_ioctl,
206178 .hw_params = go7007_snd_hw_params,
207179 .hw_free = go7007_snd_hw_free,
208180 .prepare = go7007_snd_pcm_prepare,
209181 .trigger = go7007_snd_pcm_trigger,
210182 .pointer = go7007_snd_pcm_pointer,
211
- .page = go7007_snd_pcm_page,
212183 };
213184
214185 static int go7007_snd_free(struct snd_device *device)
....@@ -256,14 +227,16 @@
256227 if (ret < 0)
257228 goto free_card;
258229
259
- strlcpy(gosnd->card->driver, "go7007", sizeof(gosnd->card->driver));
260
- strlcpy(gosnd->card->shortname, go->name, sizeof(gosnd->card->driver));
261
- strlcpy(gosnd->card->longname, gosnd->card->shortname,
262
- sizeof(gosnd->card->longname));
230
+ strscpy(gosnd->card->driver, "go7007", sizeof(gosnd->card->driver));
231
+ strscpy(gosnd->card->shortname, go->name, sizeof(gosnd->card->shortname));
232
+ strscpy(gosnd->card->longname, gosnd->card->shortname,
233
+ sizeof(gosnd->card->longname));
263234
264235 gosnd->pcm->private_data = go;
265236 snd_pcm_set_ops(gosnd->pcm, SNDRV_PCM_STREAM_CAPTURE,
266237 &go7007_snd_capture_ops);
238
+ snd_pcm_set_managed_buffer_all(gosnd->pcm, SNDRV_DMA_TYPE_VMALLOC,
239
+ NULL, 0, 0);
267240
268241 ret = snd_card_register(gosnd->card);
269242 if (ret < 0)