Skip to content

Commit 3210285

Browse files
committed
ASoC: SOF: Use no_reply calls for TX
Convert all existing calls that pass "NULL, 0" for reply data to the new no_reply calls. Also convert any calls that pass in data but don't actually parse the result. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
1 parent cf828ea commit 3210285

File tree

11 files changed

+37
-73
lines changed

11 files changed

+37
-73
lines changed

sound/soc/sof/compress.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ static int sof_compr_free(struct snd_soc_component *component,
134134
struct sof_compr_stream *sstream = cstream->runtime->private_data;
135135
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
136136
struct sof_ipc_stream stream;
137-
struct sof_ipc_reply reply;
138137
struct snd_sof_pcm *spcm;
139138
int ret = 0;
140139

@@ -147,8 +146,7 @@ static int sof_compr_free(struct snd_soc_component *component,
147146
stream.comp_id = spcm->stream[cstream->direction].comp_id;
148147

149148
if (spcm->prepared[cstream->direction]) {
150-
ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream),
151-
&reply, sizeof(reply));
149+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream));
152150
if (!ret)
153151
spcm->prepared[cstream->direction] = false;
154152
}
@@ -166,7 +164,6 @@ static int sof_compr_set_params(struct snd_soc_component *component,
166164
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
167165
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
168166
struct snd_compr_runtime *crtd = cstream->runtime;
169-
struct sof_ipc_pcm_params_reply ipc_params_reply;
170167
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
171168
struct sof_ipc_fw_version *v = &ready->version;
172169
struct sof_compr_stream *sstream;
@@ -230,8 +227,7 @@ static int sof_compr_set_params(struct snd_soc_component *component,
230227

231228
memcpy((u8 *)pcm->params.ext_data, &params->codec, ext_data_size);
232229

233-
ret = sof_ipc_tx_message(sdev->ipc, pcm, sizeof(*pcm) + ext_data_size,
234-
&ipc_params_reply, sizeof(ipc_params_reply));
230+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, pcm, sizeof(*pcm) + ext_data_size);
235231
if (ret < 0) {
236232
dev_err(component->dev, "error ipc failed\n");
237233
goto out;
@@ -264,7 +260,6 @@ static int sof_compr_trigger(struct snd_soc_component *component,
264260
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
265261
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
266262
struct sof_ipc_stream stream;
267-
struct sof_ipc_reply reply;
268263
struct snd_sof_pcm *spcm;
269264

270265
spcm = snd_sof_find_spcm_dai(component, rtd);
@@ -293,8 +288,7 @@ static int sof_compr_trigger(struct snd_soc_component *component,
293288
break;
294289
}
295290

296-
return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream),
297-
&reply, sizeof(reply));
291+
return sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream));
298292
}
299293

300294
static int sof_compr_copy_playback(struct snd_compr_runtime *rtd,

sound/soc/sof/intel/hda-loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
557557
goto cleanup;
558558
}
559559

560-
ret = sof_ipc_tx_message(sdev->ipc, &msg, 0, NULL, 0);
560+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &msg, 0);
561561

562562
ret1 = cl_trigger(sdev, hext_stream, SNDRV_PCM_TRIGGER_STOP);
563563
if (ret1 < 0) {

sound/soc/sof/ipc3-dtrace.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static int ipc3_trace_update_filter(struct snd_sof_dev *sdev, int num_elems,
150150
struct sof_ipc_trace_filter_elem *elems)
151151
{
152152
struct sof_ipc_trace_filter *msg;
153-
struct sof_ipc_reply reply;
154153
size_t size;
155154
int ret;
156155

@@ -172,13 +171,13 @@ static int ipc3_trace_update_filter(struct snd_sof_dev *sdev, int num_elems,
172171
dev_err(sdev->dev, "enabling device failed: %d\n", ret);
173172
goto error;
174173
}
175-
ret = sof_ipc_tx_message(sdev->ipc, msg, msg->hdr.size, &reply, sizeof(reply));
174+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, msg, msg->hdr.size);
176175
pm_runtime_mark_last_busy(sdev->dev);
177176
pm_runtime_put_autosuspend(sdev->dev);
178177

179178
error:
180179
kfree(msg);
181-
return ret ? ret : reply.error;
180+
return ret;
182181
}
183182

184183
static ssize_t dfsentry_trace_filter_write(struct file *file, const char __user *from,
@@ -434,7 +433,6 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
434433
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
435434
struct sof_ipc_fw_version *v = &ready->version;
436435
struct sof_ipc_dma_trace_params_ext params;
437-
struct sof_ipc_reply ipc_reply;
438436
int ret;
439437

440438
if (!sdev->fw_trace_is_supported)
@@ -474,7 +472,7 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
474472

475473
/* send IPC to the DSP */
476474
priv->dtrace_state = SOF_DTRACE_INITIALIZING;
477-
ret = sof_ipc_tx_message(sdev->ipc, &params, sizeof(params), &ipc_reply, sizeof(ipc_reply));
475+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &params, sizeof(params));
478476
if (ret < 0) {
479477
dev_err(sdev->dev, "can't set params for DMA for trace %d\n", ret);
480478
goto trace_release;
@@ -604,7 +602,6 @@ static void ipc3_dtrace_release(struct snd_sof_dev *sdev, bool only_stop)
604602
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
605603
struct sof_ipc_fw_version *v = &ready->version;
606604
struct sof_ipc_cmd_hdr hdr;
607-
struct sof_ipc_reply ipc_reply;
608605
int ret;
609606

610607
if (!sdev->fw_trace_is_supported || priv->dtrace_state == SOF_DTRACE_DISABLED)
@@ -623,8 +620,7 @@ static void ipc3_dtrace_release(struct snd_sof_dev *sdev, bool only_stop)
623620
hdr.size = sizeof(hdr);
624621
hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_FREE;
625622

626-
ret = sof_ipc_tx_message(sdev->ipc, &hdr, hdr.size,
627-
&ipc_reply, sizeof(ipc_reply));
623+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &hdr, hdr.size);
628624
if (ret < 0)
629625
dev_err(sdev->dev, "DMA_TRACE_FREE failed with error: %d\n", ret);
630626
}

sound/soc/sof/ipc3-pcm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ static int sof_ipc3_pcm_hw_free(struct snd_soc_component *component,
1919
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
2020
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
2121
struct sof_ipc_stream stream;
22-
struct sof_ipc_reply reply;
2322
struct snd_sof_pcm *spcm;
2423

2524
spcm = snd_sof_find_spcm_dai(component, rtd);
@@ -34,7 +33,7 @@ static int sof_ipc3_pcm_hw_free(struct snd_soc_component *component,
3433
stream.comp_id = spcm->stream[substream->stream].comp_id;
3534

3635
/* send IPC to the DSP */
37-
return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
36+
return sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream));
3837
}
3938

4039
static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
@@ -145,7 +144,6 @@ static int sof_ipc3_pcm_trigger(struct snd_soc_component *component,
145144
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
146145
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
147146
struct sof_ipc_stream stream;
148-
struct sof_ipc_reply reply;
149147
struct snd_sof_pcm *spcm;
150148

151149
spcm = snd_sof_find_spcm_dai(component, rtd);
@@ -177,7 +175,7 @@ static int sof_ipc3_pcm_trigger(struct snd_soc_component *component,
177175
}
178176

179177
/* send IPC to the DSP */
180-
return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
178+
return sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream));
181179
}
182180

183181
static void ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev, const char *link_name,

sound/soc/sof/ipc3-topology.c

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,6 @@ static void sof_ipc3_widget_free_comp_dai(struct snd_sof_widget *swidget)
16271627
static int sof_ipc3_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *sroute)
16281628
{
16291629
struct sof_ipc_pipe_comp_connect connect;
1630-
struct sof_ipc_reply reply;
16311630
int ret;
16321631

16331632
connect.hdr.size = sizeof(connect);
@@ -1640,7 +1639,7 @@ static int sof_ipc3_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
16401639
sroute->sink_widget->widget->name);
16411640

16421641
/* send ipc */
1643-
ret = sof_ipc_tx_message(sdev->ipc, &connect, sizeof(connect), &reply, sizeof(reply));
1642+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &connect, sizeof(connect));
16441643
if (ret < 0)
16451644
dev_err(sdev->dev, "%s: route %s -> %s failed\n", __func__,
16461645
sroute->src_widget->widget->name, sroute->sink_widget->widget->name);
@@ -1789,15 +1788,14 @@ static int sof_ipc3_control_free(struct snd_sof_dev *sdev, struct snd_sof_contro
17891788
fcomp.id = scontrol->comp_id;
17901789

17911790
/* send IPC to the DSP */
1792-
return sof_ipc_tx_message(sdev->ipc, &fcomp, sizeof(fcomp), NULL, 0);
1791+
return sof_ipc_tx_message_no_reply(sdev->ipc, &fcomp, sizeof(fcomp));
17931792
}
17941793

17951794
/* send pcm params ipc */
17961795
static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, int dir)
17971796
{
17981797
struct snd_soc_component *scomp = swidget->scomp;
17991798
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
1800-
struct sof_ipc_pcm_params_reply ipc_params_reply;
18011799
struct snd_pcm_hw_params *params;
18021800
struct sof_ipc_pcm_params pcm;
18031801
struct snd_sof_pcm *spcm;
@@ -1841,8 +1839,7 @@ static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, in
18411839
}
18421840

18431841
/* send IPC to the DSP */
1844-
ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
1845-
&ipc_params_reply, sizeof(ipc_params_reply));
1842+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &pcm, sizeof(pcm));
18461843
if (ret < 0)
18471844
dev_err(scomp->dev, "%s: PCM params failed for %s\n", __func__,
18481845
swidget->widget->name);
@@ -1856,7 +1853,6 @@ static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int c
18561853
struct snd_soc_component *scomp = swidget->scomp;
18571854
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
18581855
struct sof_ipc_stream stream;
1859-
struct sof_ipc_reply reply;
18601856
int ret;
18611857

18621858
/* set IPC stream params */
@@ -1865,7 +1861,7 @@ static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int c
18651861
stream.comp_id = swidget->comp_id;
18661862

18671863
/* send IPC to the DSP */
1868-
ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
1864+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream));
18691865
if (ret < 0)
18701866
dev_err(scomp->dev, "%s: Failed to trigger %s\n", __func__, swidget->widget->name);
18711867

@@ -1982,7 +1978,6 @@ static int sof_ipc3_widget_bind_event(struct snd_soc_component *scomp,
19821978
static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
19831979
{
19841980
struct sof_ipc_pipe_ready ready;
1985-
struct sof_ipc_reply reply;
19861981
int ret;
19871982

19881983
dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
@@ -1993,7 +1988,7 @@ static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_w
19931988
ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
19941989
ready.comp_id = swidget->comp_id;
19951990

1996-
ret = sof_ipc_tx_message(sdev->ipc, &ready, sizeof(ready), &reply, sizeof(reply));
1991+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &ready, sizeof(ready));
19971992
if (ret < 0)
19981993
return ret;
19991994

@@ -2009,7 +2004,6 @@ static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
20092004
},
20102005
.id = swidget->comp_id,
20112006
};
2012-
struct sof_ipc_reply reply;
20132007
int ret;
20142008

20152009
if (!swidget->private)
@@ -2029,8 +2023,7 @@ static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
20292023
break;
20302024
}
20312025

2032-
ret = sof_ipc_tx_message(sdev->ipc, &ipc_free, sizeof(ipc_free),
2033-
&reply, sizeof(reply));
2026+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, &ipc_free, sizeof(ipc_free));
20342027
if (ret < 0)
20352028
dev_err(sdev->dev, "failed to free widget %s\n", swidget->widget->name);
20362029

@@ -2044,7 +2037,6 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
20442037
struct snd_sof_dai *dai = swidget->private;
20452038
struct sof_dai_private_data *private;
20462039
struct sof_ipc_dai_config *config;
2047-
struct sof_ipc_reply reply;
20482040
int ret = 0;
20492041

20502042
if (!dai || !dai->private) {
@@ -2118,8 +2110,7 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
21182110

21192111
/* only send the IPC if the widget is set up in the DSP */
21202112
if (swidget->use_count > 0) {
2121-
ret = sof_ipc_tx_message(sdev->ipc, config, config->hdr.size,
2122-
&reply, sizeof(reply));
2113+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, config, config->hdr.size);
21232114
if (ret < 0)
21242115
dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name);
21252116

@@ -2132,7 +2123,6 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
21322123

21332124
static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
21342125
{
2135-
struct sof_ipc_comp_reply reply;
21362126
int ret;
21372127

21382128
if (!swidget->private)
@@ -2146,26 +2136,23 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
21462136
struct sof_dai_private_data *dai_data = dai->private;
21472137
struct sof_ipc_comp *comp = &dai_data->comp_dai->comp;
21482138

2149-
ret = sof_ipc_tx_message(sdev->ipc, dai_data->comp_dai,
2150-
comp->hdr.size, &reply, sizeof(reply));
2139+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, dai_data->comp_dai, comp->hdr.size);
21512140
break;
21522141
}
21532142
case snd_soc_dapm_scheduler:
21542143
{
21552144
struct sof_ipc_pipe_new *pipeline;
21562145

21572146
pipeline = swidget->private;
2158-
ret = sof_ipc_tx_message(sdev->ipc, pipeline, sizeof(*pipeline),
2159-
&reply, sizeof(reply));
2147+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, pipeline, sizeof(*pipeline));
21602148
break;
21612149
}
21622150
default:
21632151
{
21642152
struct sof_ipc_cmd_hdr *hdr;
21652153

21662154
hdr = swidget->private;
2167-
ret = sof_ipc_tx_message(sdev->ipc, swidget->private, hdr->size,
2168-
&reply, sizeof(reply));
2155+
ret = sof_ipc_tx_message_no_reply(sdev->ipc, swidget->private, hdr->size);
21692156
break;
21702157
}
21712158
}

sound/soc/sof/ipc3.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,15 +1043,13 @@ static int sof_ipc3_set_core_state(struct snd_sof_dev *sdev, int core_idx, bool
10431043
.hdr.size = sizeof(core_cfg),
10441044
.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE,
10451045
};
1046-
struct sof_ipc_reply reply;
10471046

10481047
if (on)
10491048
core_cfg.enable_mask = sdev->enabled_cores_mask | BIT(core_idx);
10501049
else
10511050
core_cfg.enable_mask = sdev->enabled_cores_mask & ~BIT(core_idx);
10521051

1053-
return sof_ipc3_tx_msg(sdev, &core_cfg, sizeof(core_cfg),
1054-
&reply, sizeof(reply), false);
1052+
return sof_ipc3_tx_msg(sdev, &core_cfg, sizeof(core_cfg), NULL, 0, false);
10551053
}
10561054

10571055
static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd)
@@ -1060,11 +1058,9 @@ static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd)
10601058
.hdr.size = sizeof(pm_ctx),
10611059
.hdr.cmd = SOF_IPC_GLB_PM_MSG | cmd,
10621060
};
1063-
struct sof_ipc_reply reply;
10641061

10651062
/* send ctx save ipc to dsp */
1066-
return sof_ipc3_tx_msg(sdev, &pm_ctx, sizeof(pm_ctx),
1067-
&reply, sizeof(reply), false);
1063+
return sof_ipc3_tx_msg(sdev, &pm_ctx, sizeof(pm_ctx), NULL, 0, false);
10681064
}
10691065

10701066
static int sof_ipc3_ctx_save(struct snd_sof_dev *sdev)
@@ -1080,7 +1076,6 @@ static int sof_ipc3_ctx_restore(struct snd_sof_dev *sdev)
10801076
static int sof_ipc3_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
10811077
{
10821078
struct sof_ipc_pm_gate pm_gate;
1083-
struct sof_ipc_reply reply;
10841079

10851080
memset(&pm_gate, 0, sizeof(pm_gate));
10861081

@@ -1090,8 +1085,7 @@ static int sof_ipc3_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
10901085
pm_gate.flags = flags;
10911086

10921087
/* send pm_gate ipc to dsp */
1093-
return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate),
1094-
&reply, sizeof(reply));
1088+
return sof_ipc_tx_message_no_pm_no_reply(sdev->ipc, &pm_gate, sizeof(pm_gate));
10951089
}
10961090

10971091
static const struct sof_ipc_pm_ops ipc3_pm_ops = {

sound/soc/sof/ipc4-pcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state
3939
msg.data_size = ipc_size;
4040
msg.data_ptr = trigger_list;
4141

42-
return sof_ipc_tx_message(sdev->ipc, &msg, ipc_size, NULL, 0);
42+
return sof_ipc_tx_message_no_reply(sdev->ipc, &msg, ipc_size);
4343
}
4444

4545
int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state)
@@ -57,7 +57,7 @@ int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state)
5757

5858
msg.primary = primary;
5959

60-
return sof_ipc_tx_message(sdev->ipc, &msg, 0, NULL, 0);
60+
return sof_ipc_tx_message_no_reply(sdev->ipc, &msg, 0);
6161
}
6262
EXPORT_SYMBOL(sof_ipc4_set_pipeline_state);
6363

0 commit comments

Comments
 (0)