]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: bcm2835-audio: Use PCM runtime values instead
authorTakashi Iwai <tiwai@suse.de>
Tue, 4 Sep 2018 15:58:40 +0000 (17:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Sep 2018 09:14:59 +0000 (11:14 +0200)
Some fields in alsa_stream are the values we keep already in PCM
runtime object, hence they are redundant.  Use the standard PCM
runtime values instead of the private copies.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
drivers/staging/vc04_services/bcm2835-audio/bcm2835.h

index fc1b345d206cd79370c4028e31e1b38f8f7c3f2f..a3605505cc20bd6c8d58b6e1c870be0257272138 100644 (file)
@@ -206,22 +206,7 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
 static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
-       int err;
-
-       err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
-       if (err < 0) {
-               audio_error
-                       (" pcm_lib_malloc failed to allocated pages for buffers\n");
-               return err;
-       }
-
-       alsa_stream->channels = params_channels(params);
-       alsa_stream->params_rate = params_rate(params);
-       alsa_stream->pcm_format_width = snd_pcm_format_width(params_format(params));
-
-       return err;
+       return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
 }
 
 /* hw_free callback */
@@ -248,11 +233,11 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
        if (chip->spdif_status & IEC958_AES0_NONAUDIO)
                channels = 0;
        else
-               channels = alsa_stream->channels;
+               channels = runtime->channels;
 
        err = bcm2835_audio_set_params(alsa_stream, channels,
-               alsa_stream->params_rate,
-               alsa_stream->pcm_format_width);
+                                      runtime->rate,
+                                      snd_pcm_format_width(runtime->format));
        if (err < 0)
                audio_error(" error setting hw params\n");
 
index 20f5ff1649e6b5fdd2e1114849bb6a1e04c2106d..3bf128422a6fdce2031ce1670eb9398764b9909a 100644 (file)
@@ -121,10 +121,6 @@ struct bcm2835_alsa_stream {
 
        int draining;
 
-       int channels;
-       int params_rate;
-       int pcm_format_width;
-
        unsigned int pos;
        unsigned int buffer_size;
        unsigned int period_size;