Skip to content

Commit 28c90d5

Browse files
lrgirdwolgirdwood
authored andcommitted
ipc4: base_fw: mark add_codec_info_item __maybe_unused and use everywhere
Use add_codec_info_item() uniformly across all entries in get_codec_info() and mark the helper __maybe_unused so builds that disable optional codec Kconfigs (such as stub-build (4) with clang -Werror -Wunused-function -fno-inline-functions) do not fail with an unused-function error. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 59fc0fd commit 28c90d5

1 file changed

Lines changed: 43 additions & 42 deletions

File tree

‎src/kernel/audio/base_fw.c‎

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ struct sof_ipc4_codec_info_data {
8787
*/
8888
#define SET_CODEC_INFO_ITEM(codec, dir) (((codec) & 0xff) | (((dir) & 0xf) << 8))
8989

90-
static inline void add_codec_info_item(struct sof_ipc4_codec_info_data *info,
91-
uint32_t codec, uint32_t dir)
90+
static inline __maybe_unused void
91+
add_codec_info_item(struct sof_ipc4_codec_info_data *info,
92+
uint32_t codec, uint32_t dir)
9293
{
9394
if (info->count < ARRAY_SIZE(info->items)) {
9495
info->items[info->count++] = SET_CODEC_INFO_ITEM(codec, dir);
@@ -100,104 +101,104 @@ static void get_codec_info(struct sof_tlv **tuple)
100101
struct sof_ipc4_codec_info_data codec_info = { 0 };
101102

102103
#ifdef CONFIG_CADENCE_CODEC_AAC_DEC
103-
codec_info.items[codec_info.count++] =
104-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_AAC, SOF_IPC_STREAM_PLAYBACK);
104+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_AAC,
105+
SOF_IPC_STREAM_PLAYBACK);
105106
#endif
106107
#ifdef CONFIG_CADENCE_CODEC_MP3_DEC
107-
codec_info.items[codec_info.count++] =
108-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_PLAYBACK);
108+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_MP3,
109+
SOF_IPC_STREAM_PLAYBACK);
109110
#endif
110111
#ifdef CONFIG_CADENCE_CODEC_MP3_ENC
111-
codec_info.items[codec_info.count++] =
112-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_CAPTURE);
112+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_MP3,
113+
SOF_IPC_STREAM_CAPTURE);
113114
#endif
114115
#ifdef CONFIG_CADENCE_CODEC_VORBIS_DEC
115-
codec_info.items[codec_info.count++] =
116-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_VORBIS, SOF_IPC_STREAM_PLAYBACK);
116+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_VORBIS,
117+
SOF_IPC_STREAM_PLAYBACK);
117118
#endif
118119
#ifdef CONFIG_COMP_MFCC
119-
codec_info.items[codec_info.count++] =
120-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_BESPOKE, SOF_IPC_STREAM_CAPTURE);
120+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_BESPOKE,
121+
SOF_IPC_STREAM_CAPTURE);
121122
#endif
122123
#if defined(CONFIG_SOF_COMPRESS_CODEC_PCM_DEC) || defined(CONFIG_FFMPEG_FILTER)
123-
codec_info.items[codec_info.count++] =
124-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_PCM, SOF_IPC_STREAM_PLAYBACK);
124+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_PCM,
125+
SOF_IPC_STREAM_PLAYBACK);
125126
#endif
126127
#ifdef CONFIG_FFMPEG_DEC_FLAC
127128
/* FLAC decode is provided by the ffmpeg_dec (libavcodec) module. */
128-
codec_info.items[codec_info.count++] =
129-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_FLAC, SOF_IPC_STREAM_PLAYBACK);
129+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_FLAC,
130+
SOF_IPC_STREAM_PLAYBACK);
130131
#endif
131132
#ifdef CONFIG_FFMPEG_DEC_ALAC
132133
/* ALAC decode is provided by the ffmpeg_dec (libavcodec) module. */
133-
codec_info.items[codec_info.count++] =
134-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_ALAC, SOF_IPC_STREAM_PLAYBACK);
134+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_ALAC,
135+
SOF_IPC_STREAM_PLAYBACK);
135136
#endif
136137
#if defined(CONFIG_FFMPEG_DEC_AAC) && !defined(CONFIG_CADENCE_CODEC_AAC_DEC)
137138
/* AAC-LC decode is provided by the ffmpeg_dec (libavcodec) module (guarded so
138139
* it is not advertised twice when the Cadence AAC decoder is also present).
139140
*/
140-
codec_info.items[codec_info.count++] =
141-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_AAC, SOF_IPC_STREAM_PLAYBACK);
141+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_AAC,
142+
SOF_IPC_STREAM_PLAYBACK);
142143
#endif
143144
#if defined(CONFIG_FFMPEG_DEC_MP3) && !defined(CONFIG_CADENCE_CODEC_MP3_DEC)
144145
/* MP3 decode is provided by the ffmpeg_dec (libavcodec) module (guarded so
145146
* it is not advertised twice when the Cadence MP3 decoder is also present).
146147
*/
147-
codec_info.items[codec_info.count++] =
148-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_PLAYBACK);
148+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_MP3,
149+
SOF_IPC_STREAM_PLAYBACK);
149150
#endif
150151
#if defined(CONFIG_FFMPEG_ENC_MP3) && !defined(CONFIG_CADENCE_CODEC_MP3_ENC)
151152
/* MP3 encode (compress capture) via ffmpeg_dec (libshine), guarded so it is
152153
* not advertised twice when the Cadence MP3 encoder is also present.
153154
*/
154-
codec_info.items[codec_info.count++] =
155-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_CAPTURE);
155+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_MP3,
156+
SOF_IPC_STREAM_CAPTURE);
156157
#endif
157158
#if defined(CONFIG_FFMPEG_ENC_AAC)
158159
/* AAC-LC encode (compress capture) via ffmpeg_dec (vo-aacenc). */
159-
codec_info.items[codec_info.count++] =
160-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_AAC, SOF_IPC_STREAM_CAPTURE);
160+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_AAC,
161+
SOF_IPC_STREAM_CAPTURE);
161162
#endif
162163
#if defined(CONFIG_FFMPEG_ENC_FLAC)
163164
/* FLAC encode (compress capture) via ffmpeg_enc (native libavcodec). */
164-
codec_info.items[codec_info.count++] =
165-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_FLAC, SOF_IPC_STREAM_CAPTURE);
165+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_FLAC,
166+
SOF_IPC_STREAM_CAPTURE);
166167
#endif
167168
#if defined(CONFIG_FFMPEG_ENC_ALAC)
168169
/* ALAC encode (compress capture) via ffmpeg_enc (native libavcodec). */
169-
codec_info.items[codec_info.count++] =
170-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_ALAC, SOF_IPC_STREAM_CAPTURE);
170+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_ALAC,
171+
SOF_IPC_STREAM_CAPTURE);
171172
#endif
172173
#if defined(CONFIG_FFMPEG_DEC_SBC)
173174
/* Bluetooth SBC / mSBC decode via ffmpeg_dec (native libavcodec). */
174-
codec_info.items[codec_info.count++] =
175-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_SBC, SOF_IPC_STREAM_PLAYBACK);
175+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_SBC,
176+
SOF_IPC_STREAM_PLAYBACK);
176177
#endif
177178
#if defined(CONFIG_FFMPEG_ENC_SBC)
178179
/* Bluetooth SBC / mSBC encode via ffmpeg_enc (native libavcodec). */
179-
codec_info.items[codec_info.count++] =
180-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_SBC, SOF_IPC_STREAM_CAPTURE);
180+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_SBC,
181+
SOF_IPC_STREAM_CAPTURE);
181182
#endif
182183
#if defined(CONFIG_FFMPEG_DEC_G722)
183184
/* ITU-T G.722 wideband speech decode via ffmpeg_dec (native libavcodec). */
184-
codec_info.items[codec_info.count++] =
185-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_G722, SOF_IPC_STREAM_PLAYBACK);
185+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_G722,
186+
SOF_IPC_STREAM_PLAYBACK);
186187
#endif
187188
#if defined(CONFIG_FFMPEG_ENC_G722)
188189
/* ITU-T G.722 wideband speech encode via ffmpeg_enc (native libavcodec). */
189-
codec_info.items[codec_info.count++] =
190-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_G722, SOF_IPC_STREAM_CAPTURE);
190+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_G722,
191+
SOF_IPC_STREAM_CAPTURE);
191192
#endif
192193
#if defined(CONFIG_FFMPEG_DEC_APTX)
193194
/* Bluetooth aptX decode via ffmpeg_dec (native libavcodec). */
194-
codec_info.items[codec_info.count++] =
195-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_APTX, SOF_IPC_STREAM_PLAYBACK);
195+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_APTX,
196+
SOF_IPC_STREAM_PLAYBACK);
196197
#endif
197198
#if defined(CONFIG_FFMPEG_ENC_APTX)
198199
/* Bluetooth aptX encode via ffmpeg_enc (native libavcodec). */
199-
codec_info.items[codec_info.count++] =
200-
SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_APTX, SOF_IPC_STREAM_CAPTURE);
200+
add_codec_info_item(&codec_info, SND_AUDIOCODEC_APTX,
201+
SOF_IPC_STREAM_CAPTURE);
201202
#endif
202203
#if defined(CONFIG_FFMPEG_DEC_APTX_HD)
203204
/* Bluetooth aptX HD decode via ffmpeg_dec (native libavcodec). */

0 commit comments

Comments
 (0)