From: Takashi Iwai Date: Mon, 9 Dec 2019 09:48:54 +0000 (+0100) Subject: ALSA: als4000: Use managed buffer allocation X-Git-Tag: v5.15~4528^2~328 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96bcfde13a1cb8979c0e4fb35f99be2d072c21bd;p=platform%2Fkernel%2Flinux-starfive.git ALSA: als4000: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-23-tiwai@suse.de Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index d6f5487..ea51913 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -354,18 +354,6 @@ CMD_SIGNED|CMD_STEREO, /* ALS4000_FORMAT_S16L_STEREO */ }; #define capture_cmd(chip) (capture_cmd_vals[(chip)->capture_format]) -static int snd_als4000_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_als4000_hw_free(struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int snd_als4000_capture_prepare(struct snd_pcm_substream *substream) { struct snd_sb *chip = snd_pcm_substream_chip(substream); @@ -633,7 +621,6 @@ static int snd_als4000_playback_close(struct snd_pcm_substream *substream) struct snd_sb *chip = snd_pcm_substream_chip(substream); chip->playback_substream = NULL; - snd_pcm_lib_free_pages(substream); return 0; } @@ -652,7 +639,6 @@ static int snd_als4000_capture_close(struct snd_pcm_substream *substream) struct snd_sb *chip = snd_pcm_substream_chip(substream); chip->capture_substream = NULL; - snd_pcm_lib_free_pages(substream); return 0; } @@ -662,8 +648,6 @@ static const struct snd_pcm_ops snd_als4000_playback_ops = { .open = snd_als4000_playback_open, .close = snd_als4000_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als4000_hw_params, - .hw_free = snd_als4000_hw_free, .prepare = snd_als4000_playback_prepare, .trigger = snd_als4000_playback_trigger, .pointer = snd_als4000_playback_pointer @@ -673,8 +657,6 @@ static const struct snd_pcm_ops snd_als4000_capture_ops = { .open = snd_als4000_capture_open, .close = snd_als4000_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als4000_hw_params, - .hw_free = snd_als4000_hw_free, .prepare = snd_als4000_capture_prepare, .trigger = snd_als4000_capture_trigger, .pointer = snd_als4000_capture_pointer @@ -693,9 +675,8 @@ static int snd_als4000_pcm(struct snd_sb *chip, int device) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_als4000_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_als4000_capture_ops); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - &chip->pci->dev, - 64*1024, 64*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + &chip->pci->dev, 64*1024, 64*1024); chip->pcm = pcm;