0955df559513aa3d146a40ea69d1c988bedd5be4
[oweals/openwrt.git] /
1 From 50292f7a57de792cb23b3883594b0e102e74e9e2 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:44 +0200
4 Subject: [PATCH 454/703] staging: bcm2835-audio: Drop debug messages in
5  bcm2835-pcm.c
6
7 commit 055e1c330d04df87d4730a5db837161c11ddaafc upstream.
8
9 These debug messages worsen the code readability a lot while they give
10 little debuggability (which we already have via tracing, in anyway).
11
12 Let's clean them up.  This allows us to reduce the
13 snd_bcm2835_pcm_lib_ioctl() function to be a direct call of the
14 snd_pcm_lib_ioctl callback (like most other drivers do), too.
15
16 Signed-off-by: Takashi Iwai <tiwai@suse.de>
17 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20  .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 51 +++----------------
21  1 file changed, 7 insertions(+), 44 deletions(-)
22
23 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
24 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
25 @@ -44,9 +44,7 @@ static const struct snd_pcm_hardware snd
26  
27  static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime)
28  {
29 -       audio_info("Freeing up alsa stream here ..\n");
30         kfree(runtime->private_data);
31 -       runtime->private_data = NULL;
32  }
33  
34  void bcm2835_playback_fifo(struct bcm2835_alsa_stream *alsa_stream)
35 @@ -99,7 +97,6 @@ static int snd_bcm2835_playback_open_gen
36         int err;
37  
38         mutex_lock(&chip->audio_mutex);
39 -       audio_info("Alsa open (%d)\n", substream->number);
40         idx = substream->number;
41  
42         if (spdif && chip->opened) {
43 @@ -182,8 +179,6 @@ static int snd_bcm2835_playback_close(st
44         runtime = substream->runtime;
45         alsa_stream = runtime->private_data;
46  
47 -       audio_info("Alsa close\n");
48 -
49         alsa_stream->period_size = 0;
50         alsa_stream->buffer_size = 0;
51  
52 @@ -251,10 +246,6 @@ static int snd_bcm2835_pcm_prepare(struc
53         alsa_stream->pos = 0;
54         alsa_stream->draining = false;
55  
56 -       audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n",
57 -               alsa_stream->buffer_size, alsa_stream->period_size,
58 -               alsa_stream->pos, runtime->frame_bits);
59 -
60   out:
61         mutex_unlock(&chip->audio_mutex);
62         return err;
63 @@ -266,12 +257,8 @@ static void snd_bcm2835_pcm_transfer(str
64         struct snd_pcm_runtime *runtime = substream->runtime;
65         struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
66         void *src = (void *) (substream->runtime->dma_area + rec->sw_data);
67 -       int err;
68 -
69 -       err = bcm2835_audio_write(alsa_stream, bytes, src);
70 -       if (err)
71 -               audio_error(" Failed to transfer to alsa device (%d)\n", err);
72  
73 +       bcm2835_audio_write(alsa_stream, bytes, src);
74  }
75  
76  static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream)
77 @@ -289,27 +276,18 @@ static int snd_bcm2835_pcm_trigger(struc
78  {
79         struct snd_pcm_runtime *runtime = substream->runtime;
80         struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
81 -       int err = 0;
82  
83         switch (cmd) {
84         case SNDRV_PCM_TRIGGER_START:
85 -               err = bcm2835_audio_start(alsa_stream);
86 -               if (err)
87 -                       audio_error(" Failed to START alsa device (%d)\n", err);
88 -               break;
89 +               return bcm2835_audio_start(alsa_stream);
90         case SNDRV_PCM_TRIGGER_DRAIN:
91                 alsa_stream->draining = true;
92 -               break;
93 +               return 0;
94         case SNDRV_PCM_TRIGGER_STOP:
95 -               err = bcm2835_audio_stop(alsa_stream);
96 -               if (err)
97 -                       audio_error(" Failed to STOP alsa device (%d)\n", err);
98 -               break;
99 +               return bcm2835_audio_stop(alsa_stream);
100         default:
101 -               err = -EINVAL;
102 +               return -EINVAL;
103         }
104 -
105 -       return err;
106  }
107  
108  /* pointer callback */
109 @@ -319,31 +297,16 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_s
110         struct snd_pcm_runtime *runtime = substream->runtime;
111         struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
112  
113 -       audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0,
114 -               frames_to_bytes(runtime, runtime->status->hw_ptr),
115 -               frames_to_bytes(runtime, runtime->control->appl_ptr),
116 -               alsa_stream->pos);
117 -
118         return snd_pcm_indirect_playback_pointer(substream,
119                 &alsa_stream->pcm_indirect,
120                 alsa_stream->pos);
121  }
122  
123 -static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream,
124 -       unsigned int cmd, void *arg)
125 -{
126 -       int ret = snd_pcm_lib_ioctl(substream, cmd, arg);
127 -
128 -       audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream,
129 -               cmd, arg, arg ? *(unsigned int *)arg : 0, ret);
130 -       return ret;
131 -}
132 -
133  /* operators */
134  static const struct snd_pcm_ops snd_bcm2835_playback_ops = {
135         .open = snd_bcm2835_playback_open,
136         .close = snd_bcm2835_playback_close,
137 -       .ioctl = snd_bcm2835_pcm_lib_ioctl,
138 +       .ioctl = snd_pcm_lib_ioctl,
139         .hw_params = snd_bcm2835_pcm_hw_params,
140         .hw_free = snd_bcm2835_pcm_hw_free,
141         .prepare = snd_bcm2835_pcm_prepare,
142 @@ -355,7 +318,7 @@ static const struct snd_pcm_ops snd_bcm2
143  static const struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = {
144         .open = snd_bcm2835_playback_spdif_open,
145         .close = snd_bcm2835_playback_close,
146 -       .ioctl = snd_bcm2835_pcm_lib_ioctl,
147 +       .ioctl = snd_pcm_lib_ioctl,
148         .hw_params = snd_bcm2835_pcm_hw_params,
149         .hw_free = snd_bcm2835_pcm_hw_free,
150         .prepare = snd_bcm2835_pcm_prepare,