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
7 commit d048385a070552ae819f99f05bd03ec41072783d upstream.
9 When it comes to declaring variables it's preferred, when possible, to
10 use an inverted tree organization scheme.
12 Also, removes some comments that were useless.
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>
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(-)
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);
31 static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
33 - /* the hardware-specific codes will be here */
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;
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
47 -/* hw_params callback */
48 static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
49 struct snd_pcm_hw_params *params)
51 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
54 -/* hw_free callback */
55 static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream)
57 return snd_pcm_lib_free_pages(substream);
60 -/* prepare callback */
61 static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
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
69 struct bcm2835_audio_instance *instance = param;
72 struct vc_audio_msg m;
76 if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
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,
84 - struct snd_card *card;
85 struct bcm2835_chip *chip;
86 + struct snd_card *card;
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
92 static int snd_add_child_devices(struct device *device, u32 numchans)
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;
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);
110 for (i = 0; i < ARRAY_SIZE(children_devices); i++) {
112 - int numchannels_this_device;
113 struct bcm2835_audio_driver *audio_driver;
114 + int numchannels_this_device;
117 if (!*children_devices[i].is_enabled)