Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: pxa: mmp-pcm: remove snd_pcm_ops

snd_pcm_ops is no longer needed.
Let's use component driver callback.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pnjf90ef.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
540e59c6 2324c8f4

+40 -22
+40 -22
sound/soc/pxa/mmp-pcm.c
··· 55 55 }, 56 56 }; 57 57 58 - static int mmp_pcm_hw_params(struct snd_pcm_substream *substream, 59 - struct snd_pcm_hw_params *params) 58 + static int mmp_pcm_hw_params(struct snd_soc_component *component, 59 + struct snd_pcm_substream *substream, 60 + struct snd_pcm_hw_params *params) 60 61 { 61 62 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); 62 63 struct dma_slave_config slave_config; ··· 78 77 return 0; 79 78 } 80 79 80 + static int mmp_pcm_trigger(struct snd_soc_component *component, 81 + struct snd_pcm_substream *substream, int cmd) 82 + { 83 + return snd_dmaengine_pcm_trigger(substream, cmd); 84 + } 85 + 86 + static snd_pcm_uframes_t mmp_pcm_pointer(struct snd_soc_component *component, 87 + struct snd_pcm_substream *substream) 88 + { 89 + return snd_dmaengine_pcm_pointer(substream); 90 + } 91 + 81 92 static bool filter(struct dma_chan *chan, void *param) 82 93 { 83 94 struct mmp_dma_data *dma_data = param; ··· 107 94 return found; 108 95 } 109 96 110 - static int mmp_pcm_open(struct snd_pcm_substream *substream) 97 + static int mmp_pcm_open(struct snd_soc_component *component, 98 + struct snd_pcm_substream *substream) 111 99 { 112 100 struct snd_soc_pcm_runtime *rtd = substream->private_data; 113 - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); 114 101 struct platform_device *pdev = to_platform_device(component->dev); 115 102 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 116 103 struct mmp_dma_data dma_data; ··· 130 117 &dma_data); 131 118 } 132 119 133 - static int mmp_pcm_mmap(struct snd_pcm_substream *substream, 134 - struct vm_area_struct *vma) 120 + static int mmp_pcm_close(struct snd_soc_component *component, 121 + struct snd_pcm_substream *substream) 122 + { 123 + return snd_dmaengine_pcm_close_release_chan(substream); 124 + } 125 + 126 + static int mmp_pcm_mmap(struct snd_soc_component *component, 127 + struct snd_pcm_substream *substream, 128 + struct vm_area_struct *vma) 135 129 { 136 130 struct snd_pcm_runtime *runtime = substream->runtime; 137 131 unsigned long off = vma->vm_pgoff; ··· 149 129 vma->vm_end - vma->vm_start, vma->vm_page_prot); 150 130 } 151 131 152 - static const struct snd_pcm_ops mmp_pcm_ops = { 153 - .open = mmp_pcm_open, 154 - .close = snd_dmaengine_pcm_close_release_chan, 155 - .ioctl = snd_pcm_lib_ioctl, 156 - .hw_params = mmp_pcm_hw_params, 157 - .trigger = snd_dmaengine_pcm_trigger, 158 - .pointer = snd_dmaengine_pcm_pointer, 159 - .mmap = mmp_pcm_mmap, 160 - }; 161 - 162 - static void mmp_pcm_free_dma_buffers(struct snd_pcm *pcm) 132 + static void mmp_pcm_free_dma_buffers(struct snd_soc_component *component, 133 + struct snd_pcm *pcm) 163 134 { 164 135 struct snd_pcm_substream *substream; 165 136 struct snd_dma_buffer *buf; ··· 199 188 return 0; 200 189 } 201 190 202 - static int mmp_pcm_new(struct snd_soc_pcm_runtime *rtd) 191 + static int mmp_pcm_new(struct snd_soc_component *component, 192 + struct snd_soc_pcm_runtime *rtd) 203 193 { 204 194 struct snd_pcm_substream *substream; 205 195 struct snd_pcm *pcm = rtd->pcm; ··· 217 205 return 0; 218 206 219 207 err: 220 - mmp_pcm_free_dma_buffers(pcm); 208 + mmp_pcm_free_dma_buffers(component, pcm); 221 209 return ret; 222 210 } 223 211 224 212 static const struct snd_soc_component_driver mmp_soc_component = { 225 213 .name = DRV_NAME, 226 - .ops = &mmp_pcm_ops, 227 - .pcm_new = mmp_pcm_new, 228 - .pcm_free = mmp_pcm_free_dma_buffers, 214 + .open = mmp_pcm_open, 215 + .close = mmp_pcm_close, 216 + .ioctl = snd_soc_pcm_lib_ioctl, 217 + .hw_params = mmp_pcm_hw_params, 218 + .trigger = mmp_pcm_trigger, 219 + .pointer = mmp_pcm_pointer, 220 + .mmap = mmp_pcm_mmap, 221 + .pcm_construct = mmp_pcm_new, 222 + .pcm_destruct = mmp_pcm_free_dma_buffers, 229 223 }; 230 224 231 225 static int mmp_pcm_probe(struct platform_device *pdev)