6b9ac81b972090f6685b89dd531a9603ddddcc60
[oweals/openwrt.git] /
1 From 604f0019cc1eaed6a316d7875fe697e53f5f105c Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Wed, 17 Oct 2018 21:01:52 +0200
4 Subject: [PATCH] staging: bcm2835-audio: reorder variable declarations
5  & remove trivial comments
6
7 commit d048385a070552ae819f99f05bd03ec41072783d upstream.
8
9 When it comes to declaring variables it's preferred, when possible, to
10 use an inverted tree organization scheme.
11
12 Also, removes some comments that were useless.
13
14 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
15 Reviewed-by: Takashi Iwai <tiwai@suse.de>
16 Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 ---
19  .../vc04_services/bcm2835-audio/bcm2835-pcm.c      | 10 ++--------
20  .../vc04_services/bcm2835-audio/bcm2835-vchiq.c    |  4 ++--
21  .../staging/vc04_services/bcm2835-audio/bcm2835.c  | 14 +++++++-------
22  3 files changed, 11 insertions(+), 17 deletions(-)
23
24 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
25 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
26 @@ -164,14 +164,11 @@ static int snd_bcm2835_playback_spdif_op
27         return snd_bcm2835_playback_open_generic(substream, 1);
28  }
29  
30 -/* close callback */
31  static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
32  {
33 -       /* the hardware-specific codes will be here */
34 -
35 -       struct bcm2835_chip *chip;
36 -       struct snd_pcm_runtime *runtime;
37         struct bcm2835_alsa_stream *alsa_stream;
38 +       struct snd_pcm_runtime *runtime;
39 +       struct bcm2835_chip *chip;
40  
41         chip = snd_pcm_substream_chip(substream);
42         mutex_lock(&chip->audio_mutex);
43 @@ -195,20 +192,17 @@ static int snd_bcm2835_playback_close(st
44         return 0;
45  }
46  
47 -/* hw_params callback */
48  static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
49         struct snd_pcm_hw_params *params)
50  {
51         return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
52  }
53  
54 -/* hw_free callback */
55  static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream)
56  {
57         return snd_pcm_lib_free_pages(substream);
58  }
59  
60 -/* prepare callback */
61  static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
62  {
63         struct bcm2835_chip *chip = snd_pcm_substream_chip(substream);
64 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
65 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
66 @@ -94,9 +94,9 @@ static void audio_vchi_callback(void *pa
67                                 void *msg_handle)
68  {
69         struct bcm2835_audio_instance *instance = param;
70 -       int status;
71 -       int msg_len;
72         struct vc_audio_msg m;
73 +       int msg_len;
74 +       int status;
75  
76         if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
77                 return;
78 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
79 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
80 @@ -161,8 +161,8 @@ static int snd_add_child_device(struct d
81                                 struct bcm2835_audio_driver *audio_driver,
82                                 u32 numchans)
83  {
84 -       struct snd_card *card;
85         struct bcm2835_chip *chip;
86 +       struct snd_card *card;
87         int err;
88  
89         err = snd_card_new(dev, -1, NULL, THIS_MODULE, sizeof(*chip), &card);
90 @@ -225,12 +225,12 @@ static int snd_add_child_device(struct d
91  
92  static int snd_add_child_devices(struct device *device, u32 numchans)
93  {
94 -       int i;
95 -       int count_devices = 0;
96 -       int minchannels = 0;
97 -       int extrachannels = 0;
98         int extrachannels_per_driver = 0;
99         int extrachannels_remainder = 0;
100 +       int count_devices = 0;
101 +       int extrachannels = 0;
102 +       int minchannels = 0;
103 +       int i;
104  
105         for (i = 0; i < ARRAY_SIZE(children_devices); i++)
106                 if (*children_devices[i].is_enabled)
107 @@ -258,9 +258,9 @@ static int snd_add_child_devices(struct
108                 extrachannels_remainder);
109  
110         for (i = 0; i < ARRAY_SIZE(children_devices); i++) {
111 -               int err;
112 -               int numchannels_this_device;
113                 struct bcm2835_audio_driver *audio_driver;
114 +               int numchannels_this_device;
115 +               int err;
116  
117                 if (!*children_devices[i].is_enabled)
118                         continue;