2912998f6a0c94d176184600d02ccbfe51299abf
[openwrt/staging/thess.git] /
1 From 4efb059f297f8234bc188b6bc1e4af673ce9f9e3 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:40 +0200
4 Subject: [PATCH 444/806] staging: bcm2835-audio: Use PCM runtime values
5 instead
6
7 commit b8f7fdd50890b848e085c0519469aed4ff4d9b54 upstream.
8
9 Some fields in alsa_stream are the values we keep already in PCM
10 runtime object, hence they are redundant. Use the standard PCM
11 runtime values instead of the private copies.
12
13 Signed-off-by: Takashi Iwai <tiwai@suse.de>
14 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 23 ++++---------------
18 .../vc04_services/bcm2835-audio/bcm2835.h | 4 ----
19 2 files changed, 4 insertions(+), 23 deletions(-)
20
21 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
22 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
23 @@ -206,22 +206,7 @@ static int snd_bcm2835_playback_close(st
24 static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
25 struct snd_pcm_hw_params *params)
26 {
27 - struct snd_pcm_runtime *runtime = substream->runtime;
28 - struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
29 - int err;
30 -
31 - err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
32 - if (err < 0) {
33 - audio_error
34 - (" pcm_lib_malloc failed to allocated pages for buffers\n");
35 - return err;
36 - }
37 -
38 - alsa_stream->channels = params_channels(params);
39 - alsa_stream->params_rate = params_rate(params);
40 - alsa_stream->pcm_format_width = snd_pcm_format_width(params_format(params));
41 -
42 - return err;
43 + return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
44 }
45
46 /* hw_free callback */
47 @@ -248,11 +233,11 @@ static int snd_bcm2835_pcm_prepare(struc
48 if (chip->spdif_status & IEC958_AES0_NONAUDIO)
49 channels = 0;
50 else
51 - channels = alsa_stream->channels;
52 + channels = runtime->channels;
53
54 err = bcm2835_audio_set_params(alsa_stream, channels,
55 - alsa_stream->params_rate,
56 - alsa_stream->pcm_format_width);
57 + runtime->rate,
58 + snd_pcm_format_width(runtime->format));
59 if (err < 0)
60 audio_error(" error setting hw params\n");
61
62 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
63 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
64 @@ -121,10 +121,6 @@ struct bcm2835_alsa_stream {
65
66 int draining;
67
68 - int channels;
69 - int params_rate;
70 - int pcm_format_width;
71 -
72 unsigned int pos;
73 unsigned int buffer_size;
74 unsigned int period_size;