e212a942ec87a6d811cca8d6bea13f7842f3883c
[openwrt/staging/stintel.git] / target / linux / brcm2708 / patches-4.19 / 950-0404-staging-bcm2835-audio-use-anonymous-union-in-struct-.patch
1 From 23b89436030e64196a1bc317901d08edd54fb772 Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Wed, 17 Oct 2018 21:01:53 +0200
4 Subject: [PATCH] staging: bcm2835-audio: use anonymous union in struct
5 vc_audio_msg
6
7 commit 9c2eaf7da855d314a369d48b9cbf8ac80717a1d0 upstream.
8
9 In this case explicitly naming the union doesn't help overall code
10 comprehension and clutters it.
11
12 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
13 Reviewed-by: Takashi Iwai <tiwai@suse.de>
14 Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 .../bcm2835-audio/bcm2835-vchiq.c | 30 +++++++++----------
18 .../bcm2835-audio/vc_vchi_audioserv_defs.h | 2 +-
19 2 files changed, 16 insertions(+), 16 deletions(-)
20
21 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
22 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
23 @@ -104,15 +104,15 @@ static void audio_vchi_callback(void *pa
24 status = vchi_msg_dequeue(instance->vchi_handle,
25 &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE);
26 if (m.type == VC_AUDIO_MSG_TYPE_RESULT) {
27 - instance->result = m.u.result.success;
28 + instance->result = m.result.success;
29 complete(&instance->msg_avail_comp);
30 } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) {
31 - if (m.u.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 ||
32 - m.u.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2)
33 + if (m.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 ||
34 + m.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2)
35 dev_err(instance->dev, "invalid cookie\n");
36 else
37 bcm2835_playback_fifo(instance->alsa_stream,
38 - m.u.complete.count);
39 + m.complete.count);
40 } else {
41 dev_err(instance->dev, "unexpected callback type=%d\n", m.type);
42 }
43 @@ -257,11 +257,11 @@ int bcm2835_audio_set_ctls(struct bcm283
44 struct vc_audio_msg m = {};
45
46 m.type = VC_AUDIO_MSG_TYPE_CONTROL;
47 - m.u.control.dest = chip->dest;
48 + m.control.dest = chip->dest;
49 if (!chip->mute)
50 - m.u.control.volume = CHIP_MIN_VOLUME;
51 + m.control.volume = CHIP_MIN_VOLUME;
52 else
53 - m.u.control.volume = alsa2chip(chip->volume);
54 + m.control.volume = alsa2chip(chip->volume);
55
56 return bcm2835_audio_send_msg(alsa_stream->instance, &m, true);
57 }
58 @@ -272,9 +272,9 @@ int bcm2835_audio_set_params(struct bcm2
59 {
60 struct vc_audio_msg m = {
61 .type = VC_AUDIO_MSG_TYPE_CONFIG,
62 - .u.config.channels = channels,
63 - .u.config.samplerate = samplerate,
64 - .u.config.bps = bps,
65 + .config.channels = channels,
66 + .config.samplerate = samplerate,
67 + .config.bps = bps,
68 };
69 int err;
70
71 @@ -302,7 +302,7 @@ int bcm2835_audio_drain(struct bcm2835_a
72 {
73 struct vc_audio_msg m = {
74 .type = VC_AUDIO_MSG_TYPE_STOP,
75 - .u.stop.draining = 1,
76 + .stop.draining = 1,
77 };
78
79 return bcm2835_audio_send_msg(alsa_stream->instance, &m, false);
80 @@ -330,10 +330,10 @@ int bcm2835_audio_write(struct bcm2835_a
81 struct bcm2835_audio_instance *instance = alsa_stream->instance;
82 struct vc_audio_msg m = {
83 .type = VC_AUDIO_MSG_TYPE_WRITE,
84 - .u.write.count = size,
85 - .u.write.max_packet = instance->max_packet,
86 - .u.write.cookie1 = VC_AUDIO_WRITE_COOKIE1,
87 - .u.write.cookie2 = VC_AUDIO_WRITE_COOKIE2,
88 + .write.count = size,
89 + .write.max_packet = instance->max_packet,
90 + .write.cookie1 = VC_AUDIO_WRITE_COOKIE1,
91 + .write.cookie2 = VC_AUDIO_WRITE_COOKIE2,
92 };
93 unsigned int count;
94 int err, status;
95 --- a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
96 +++ b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
97 @@ -93,7 +93,7 @@ struct vc_audio_msg {
98 struct vc_audio_write write;
99 struct vc_audio_result result;
100 struct vc_audio_complete complete;
101 - } u;
102 + };
103 };
104
105 #endif /* _VC_AUDIO_DEFS_H_ */