From 005f3e67a855f6d1deaea84e0ab8e40c597ad10c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:50 +0100 Subject: ALSA: parisc: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-19-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'sound/parisc') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 6acc59c25379..1a4c40aafcbe 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -567,20 +567,12 @@ static int snd_harmony_hw_params(struct snd_pcm_substream *ss, struct snd_pcm_hw_params *hw) { - int err; struct snd_harmony *h = snd_pcm_substream_chip(ss); - err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw)); - if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) + if (h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) ss->runtime->dma_addr = __pa(ss->runtime->dma_area); - - return err; -} -static int -snd_harmony_hw_free(struct snd_pcm_substream *ss) -{ - return snd_pcm_lib_free_pages(ss); + return 0; } static const struct snd_pcm_ops snd_harmony_playback_ops = { @@ -588,7 +580,6 @@ static const struct snd_pcm_ops snd_harmony_playback_ops = { .close = snd_harmony_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_playback_prepare, .trigger = snd_harmony_playback_trigger, .pointer = snd_harmony_playback_pointer, @@ -599,7 +590,6 @@ static const struct snd_pcm_ops snd_harmony_capture_ops = { .close = snd_harmony_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_capture_prepare, .trigger = snd_harmony_capture_trigger, .pointer = snd_harmony_capture_pointer, @@ -656,8 +646,8 @@ snd_harmony_pcm_init(struct snd_harmony *h) } /* pre-allocate space for DMA */ - snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type, h->dma.dev, - MAX_BUF_SIZE, MAX_BUF_SIZE); + snd_pcm_set_managed_buffer_all(pcm, h->dma.type, h->dma.dev, + MAX_BUF_SIZE, MAX_BUF_SIZE); h->st.format = snd_harmony_set_data_format(h, SNDRV_PCM_FORMAT_S16_BE, 1); -- cgit From c02644684ca11b904c5105f06c988a62ef0c6dde Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:11:31 +0100 Subject: ALSA: parisc: Drop superfluous ioctl PCM ops PCM core deals the empty ioctl field now as default(*). Let's kill the redundant lines. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Link: https://lore.kernel.org/r/20191210061145.24641-10-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound/parisc') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 1a4c40aafcbe..ea3630217d39 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -578,7 +578,6 @@ snd_harmony_hw_params(struct snd_pcm_substream *ss, static const struct snd_pcm_ops snd_harmony_playback_ops = { .open = snd_harmony_playback_open, .close = snd_harmony_playback_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, .prepare = snd_harmony_playback_prepare, .trigger = snd_harmony_playback_trigger, @@ -588,7 +587,6 @@ static const struct snd_pcm_ops snd_harmony_playback_ops = { static const struct snd_pcm_ops snd_harmony_capture_ops = { .open = snd_harmony_capture_open, .close = snd_harmony_capture_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, .prepare = snd_harmony_capture_prepare, .trigger = snd_harmony_capture_trigger, -- cgit From 65341589599a17465c25ae760e9b317b3596eb8c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:29 +0100 Subject: ALSA: parisc: Constify snd_device_ops definitions Now we may declare const for snd_device_ops definitions, so let's do it for optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-14-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/parisc') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index ea3630217d39..d330f22a3e8f 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -881,7 +881,7 @@ snd_harmony_create(struct snd_card *card, { int err; struct snd_harmony *h; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_harmony_dev_free, }; -- cgit From 46708e626d0d768587cf676e55b21e0beb966be6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:58 +0100 Subject: ALSA: parisc: Constify snd_kcontrol_new items Most of snd_kcontrol_new definitions are read-only and passed as-is. Let's declare them as const for further optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-43-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/parisc') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index d330f22a3e8f..97241d984c6c 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -797,7 +797,7 @@ snd_harmony_captureroute_put(struct snd_kcontrol *kc, .private_value = ((left_shift) | ((right_shift) << 8) | \ ((mask) << 16) | ((invert) << 24)) } -static struct snd_kcontrol_new snd_harmony_controls[] = { +static const struct snd_kcontrol_new snd_harmony_controls[] = { HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT, HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, -- cgit