ASoC: SOF: Drop 'header' parameter from tx_message() API
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 30 Mar 2022 20:19:24 +0000 (13:19 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 4 Apr 2022 07:39:09 +0000 (08:39 +0100)
The header parameter is not used anymore and now it can be dropped from
the parameter list of tx_message().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220330201926.1330402-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/compress.c
sound/soc/sof/debug.c
sound/soc/sof/intel/hda-dsp.c
sound/soc/sof/intel/tgl.c
sound/soc/sof/ipc.c
sound/soc/sof/ipc3-pcm.c
sound/soc/sof/ipc3-topology.c
sound/soc/sof/ipc3.c
sound/soc/sof/sof-client.c
sound/soc/sof/sof-priv.h
sound/soc/sof/trace.c

index a8e908e..47639b6 100644 (file)
@@ -147,8 +147,7 @@ static int sof_compr_free(struct snd_soc_component *component,
        stream.comp_id = spcm->stream[cstream->direction].comp_id;
 
        if (spcm->prepared[cstream->direction]) {
-               ret = sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd,
-                                        &stream, sizeof(stream),
+               ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream),
                                         &reply, sizeof(reply));
                if (!ret)
                        spcm->prepared[cstream->direction] = false;
@@ -209,7 +208,7 @@ static int sof_compr_set_params(struct snd_soc_component *component,
                snd_pcm_format_physical_width(SNDRV_PCM_FORMAT_S32) >> 3;
        pcm.params.host_period_bytes = params->buffer.fragment_size;
 
-       ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm),
+       ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
                                 &ipc_params_reply, sizeof(ipc_params_reply));
        if (ret < 0) {
                dev_err(component->dev, "error ipc failed\n");
@@ -268,8 +267,7 @@ static int sof_compr_trigger(struct snd_soc_component *component,
                break;
        }
 
-       return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd,
-                                 &stream, sizeof(stream),
+       return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream),
                                  &reply, sizeof(reply));
 }
 
index 7b11399..8a77245 100644 (file)
@@ -236,7 +236,7 @@ static int memory_info_update(struct snd_sof_dev *sdev, char *buf, size_t buff_s
                goto error;
        }
 
-       ret = sof_ipc_tx_message(sdev->ipc, msg.cmd, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE);
+       ret = sof_ipc_tx_message(sdev->ipc, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE);
        pm_runtime_mark_last_busy(sdev->dev);
        pm_runtime_put_autosuspend(sdev->dev);
        if (ret < 0 || reply->rhdr.error < 0) {
index 8ddde60..ad11df3 100644 (file)
@@ -363,9 +363,8 @@ static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
        pm_gate.flags = flags;
 
        /* send pm_gate ipc to dsp */
-       return sof_ipc_tx_message_no_pm(sdev->ipc, pm_gate.hdr.cmd,
-                                       &pm_gate, sizeof(pm_gate), &reply,
-                                       sizeof(reply));
+       return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate),
+                                       &reply, sizeof(reply));
 }
 
 static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
@@ -985,8 +984,7 @@ int hda_dsp_core_get(struct snd_sof_dev *sdev, int core)
                return 0;
 
        /* Now notify DSP for secondary cores */
-       ret = sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd,
-                                &pm_core_config, sizeof(pm_core_config),
+       ret = sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config),
                                 &pm_core_config, sizeof(pm_core_config));
        if (ret < 0) {
                dev_err(sdev->dev, "failed to enable secondary core '%d' failed with %d\n",
index cb1c319..72d92ff 100644 (file)
@@ -35,8 +35,7 @@ static int tgl_dsp_core_get(struct snd_sof_dev *sdev, int core)
                return hda_dsp_enable_core(sdev, BIT(core));
 
        /* notify DSP for secondary cores */
-       return sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd,
-                                &pm_core_config, sizeof(pm_core_config),
+       return sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config),
                                 &pm_core_config, sizeof(pm_core_config));
 }
 
@@ -55,8 +54,7 @@ static int tgl_dsp_core_put(struct snd_sof_dev *sdev, int core)
                return hda_dsp_core_reset_power_down(sdev, BIT(core));
 
        /* notify DSP for secondary cores */
-       return sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd,
-                                &pm_core_config, sizeof(pm_core_config),
+       return sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config),
                                 &pm_core_config, sizeof(pm_core_config));
 }
 
index 46c40df..17dd51d 100644 (file)
@@ -341,9 +341,8 @@ static int sof_ipc_tx_message_unlocked(struct snd_sof_ipc *ipc,
 }
 
 /* send IPC message from host to DSP */
-int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header,
-                      void *msg_data, size_t msg_bytes, void *reply_data,
-                      size_t reply_bytes)
+int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
+                      void *reply_data, size_t reply_bytes)
 {
        const struct sof_dsp_power_state target_state = {
                .state = SOF_DSP_PM_D0,
@@ -357,7 +356,7 @@ int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header,
                return ret;
        }
 
-       return sof_ipc_tx_message_no_pm(ipc, header, msg_data, msg_bytes,
+       return sof_ipc_tx_message_no_pm(ipc, msg_data, msg_bytes,
                                        reply_data, reply_bytes);
 }
 EXPORT_SYMBOL(sof_ipc_tx_message);
@@ -367,8 +366,7 @@ EXPORT_SYMBOL(sof_ipc_tx_message);
  * This will be used for IPC's that can be handled by the DSP
  * even in a low-power D0 substate.
  */
-int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header,
-                            void *msg_data, size_t msg_bytes,
+int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
                             void *reply_data, size_t reply_bytes)
 {
        int ret;
@@ -701,8 +699,7 @@ int snd_sof_ipc_stream_posn(struct snd_soc_component *scomp,
        stream.comp_id = spcm->stream[direction].comp_id;
 
        /* send IPC to the DSP */
-       err = sof_ipc_tx_message(sdev->ipc,
-                                stream.hdr.cmd, &stream, sizeof(stream), posn,
+       err = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), posn,
                                 sizeof(*posn));
        if (err < 0) {
                dev_err(sdev->dev, "error: failed to get stream %d position\n",
@@ -893,9 +890,8 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set)
 
        /* send normal size ipc in one part */
        if (cdata->rhdr.hdr.size <= SOF_IPC_MSG_MAX_SIZE) {
-               err = sof_ipc_tx_message(sdev->ipc, cdata->rhdr.hdr.cmd, cdata,
-                                        cdata->rhdr.hdr.size, cdata,
-                                        cdata->rhdr.hdr.size);
+               err = sof_ipc_tx_message(sdev->ipc, cdata, cdata->rhdr.hdr.size,
+                                        cdata, cdata->rhdr.hdr.size);
 
                if (err < 0)
                        dev_err(sdev->dev, "error: set/get ctrl ipc comp %d\n",
index 58b7594..d7b6c67 100644 (file)
@@ -34,8 +34,7 @@ static int sof_ipc3_pcm_hw_free(struct snd_soc_component *component,
        stream.comp_id = spcm->stream[substream->stream].comp_id;
 
        /* send IPC to the DSP */
-       return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream,
-                                 sizeof(stream), &reply, sizeof(reply));
+       return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
 }
 
 static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
@@ -119,7 +118,7 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
        dev_dbg(component->dev, "stream_tag %d", pcm.params.stream_tag);
 
        /* send hw_params IPC to the DSP */
-       ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm),
+       ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
                                 &ipc_params_reply, sizeof(ipc_params_reply));
        if (ret < 0) {
                dev_err(component->dev, "HW params ipc failed for stream %d\n",
@@ -175,8 +174,7 @@ static int sof_ipc3_pcm_trigger(struct snd_soc_component *component,
        }
 
        /* send IPC to the DSP */
-       return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream,
-                                 sizeof(stream), &reply, sizeof(reply));
+       return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
 }
 
 static void ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev, const char *link_name,
index 2f8450a..8320c25 100644 (file)
@@ -1551,8 +1551,7 @@ static int sof_ipc3_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
                sroute->sink_widget->widget->name);
 
        /* send ipc */
-       ret = sof_ipc_tx_message(sdev->ipc, connect.hdr.cmd, &connect, sizeof(connect),
-                                &reply, sizeof(reply));
+       ret = sof_ipc_tx_message(sdev->ipc, &connect, sizeof(connect), &reply, sizeof(reply));
        if (ret < 0)
                dev_err(sdev->dev, "%s: route %s -> %s failed\n", __func__,
                        sroute->src_widget->widget->name, sroute->sink_widget->widget->name);
@@ -1697,7 +1696,7 @@ static int sof_ipc3_control_free(struct snd_sof_dev *sdev, struct snd_sof_contro
        fcomp.id = scontrol->comp_id;
 
        /* send IPC to the DSP */
-       return sof_ipc_tx_message(sdev->ipc, fcomp.hdr.cmd, &fcomp, sizeof(fcomp), NULL, 0);
+       return sof_ipc_tx_message(sdev->ipc, &fcomp, sizeof(fcomp), NULL, 0);
 }
 
 /* send pcm params ipc */
@@ -1749,7 +1748,7 @@ static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, in
        }
 
        /* send IPC to the DSP */
-       ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm),
+       ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
                                 &ipc_params_reply, sizeof(ipc_params_reply));
        if (ret < 0)
                dev_err(scomp->dev, "%s: PCM params failed for %s\n", __func__,
@@ -1773,8 +1772,7 @@ static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int c
        stream.comp_id = swidget->comp_id;
 
        /* send IPC to the DSP */
-       ret = sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream,
-                                sizeof(stream), &reply, sizeof(reply));
+       ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply));
        if (ret < 0)
                dev_err(scomp->dev, "%s: Failed to trigger %s\n", __func__, swidget->widget->name);
 
@@ -1902,8 +1900,7 @@ static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_w
        ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
        ready.comp_id = swidget->comp_id;
 
-       ret = sof_ipc_tx_message(sdev->ipc, ready.hdr.cmd, &ready, sizeof(ready), &reply,
-                                sizeof(reply));
+       ret = sof_ipc_tx_message(sdev->ipc, &ready, sizeof(ready), &reply, sizeof(reply));
        if (ret < 0)
                return ret;
 
@@ -1939,7 +1936,7 @@ static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
                break;
        }
 
-       ret = sof_ipc_tx_message(sdev->ipc, ipc_free.hdr.cmd, &ipc_free, sizeof(ipc_free),
+       ret = sof_ipc_tx_message(sdev->ipc, &ipc_free, sizeof(ipc_free),
                                 &reply, sizeof(reply));
        if (ret < 0)
                dev_err(sdev->dev, "failed to free widget %s\n", swidget->widget->name);
@@ -2003,7 +2000,7 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
 
        /* only send the IPC if the widget is set up in the DSP */
        if (swidget->use_count > 0) {
-               ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size,
+               ret = sof_ipc_tx_message(sdev->ipc, config, config->hdr.size,
                                         &reply, sizeof(reply));
                if (ret < 0)
                        dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name);
@@ -2028,7 +2025,7 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
                struct sof_dai_private_data *dai_data = dai->private;
                struct sof_ipc_comp *comp = &dai_data->comp_dai->comp;
 
-               ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai_data->comp_dai,
+               ret = sof_ipc_tx_message(sdev->ipc, dai_data->comp_dai,
                                         comp->hdr.size, &reply, sizeof(reply));
                break;
        }
@@ -2037,8 +2034,8 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
                struct sof_ipc_pipe_new *pipeline;
 
                pipeline = swidget->private;
-               ret = sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline,
-                                        sizeof(*pipeline), &reply, sizeof(reply));
+               ret = sof_ipc_tx_message(sdev->ipc, pipeline, sizeof(*pipeline),
+                                        &reply, sizeof(reply));
                break;
        }
        default:
@@ -2046,7 +2043,7 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
                struct sof_ipc_cmd_hdr *hdr;
 
                hdr = swidget->private;
-               ret = sof_ipc_tx_message(sdev->ipc, hdr->cmd, swidget->private, hdr->size,
+               ret = sof_ipc_tx_message(sdev->ipc, swidget->private, hdr->size,
                                         &reply, sizeof(reply));
                break;
        }
index 03e914b..a728980 100644 (file)
@@ -19,8 +19,8 @@ static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd)
        struct sof_ipc_reply reply;
 
        /* send ctx save ipc to dsp */
-       return sof_ipc_tx_message(sdev->ipc, pm_ctx.hdr.cmd, &pm_ctx,
-                                 sizeof(pm_ctx), &reply, sizeof(reply));
+       return sof_ipc_tx_message(sdev->ipc, &pm_ctx, sizeof(pm_ctx),
+                                 &reply, sizeof(reply));
 }
 
 static int sof_ipc3_ctx_save(struct snd_sof_dev *sdev)
index 686ad0c..5fb3eb2 100644 (file)
@@ -247,7 +247,7 @@ int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg,
 {
        struct sof_ipc_cmd_hdr *hdr = ipc_msg;
 
-       return sof_ipc_tx_message(cdev->sdev->ipc, hdr->cmd, ipc_msg, hdr->size,
+       return sof_ipc_tx_message(cdev->sdev->ipc, ipc_msg, hdr->size,
                                  reply_data, reply_bytes);
 }
 EXPORT_SYMBOL_NS_GPL(sof_client_ipc_tx_message, SND_SOC_SOF_CLIENT);
index 0fb1db0..fd815ae 100644 (file)
@@ -584,11 +584,9 @@ void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev);
 void snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id);
 void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev);
 int snd_sof_ipc_valid(struct snd_sof_dev *sdev);
-int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header,
-                      void *msg_data, size_t msg_bytes, void *reply_data,
-                      size_t reply_bytes);
-int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header,
-                            void *msg_data, size_t msg_bytes,
+int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
+                      void *reply_data, size_t reply_bytes);
+int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
                             void *reply_data, size_t reply_bytes);
 int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev);
 static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_id)
index 26d9381..ba6361b 100644 (file)
@@ -152,8 +152,7 @@ static int sof_ipc_trace_update_filter(struct snd_sof_dev *sdev, int num_elems,
                dev_err(sdev->dev, "error: enabling device failed: %d\n", ret);
                goto error;
        }
-       ret = sof_ipc_tx_message(sdev->ipc, msg->hdr.cmd, msg, msg->hdr.size,
-                                &reply, sizeof(reply));
+       ret = sof_ipc_tx_message(sdev->ipc, msg, msg->hdr.size, &reply, sizeof(reply));
        pm_runtime_mark_last_busy(sdev->dev);
        pm_runtime_put_autosuspend(sdev->dev);
 
@@ -430,9 +429,7 @@ static int snd_sof_enable_trace(struct snd_sof_dev *sdev)
        dev_dbg(sdev->dev, "%s: stream_tag: %d\n", __func__, params.stream_tag);
 
        /* send IPC to the DSP */
-       ret = sof_ipc_tx_message(sdev->ipc,
-                                params.hdr.cmd, &params, sizeof(params),
-                                &ipc_reply, sizeof(ipc_reply));
+       ret = sof_ipc_tx_message(sdev->ipc, &params, sizeof(params), &ipc_reply, sizeof(ipc_reply));
        if (ret < 0) {
                dev_err(sdev->dev,
                        "error: can't set params for DMA for trace %d\n", ret);
@@ -575,7 +572,7 @@ static void snd_sof_release_trace(struct snd_sof_dev *sdev, bool only_stop)
                hdr.size = sizeof(hdr);
                hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_FREE;
 
-               ret = sof_ipc_tx_message(sdev->ipc, hdr.cmd, &hdr, hdr.size,
+               ret = sof_ipc_tx_message(sdev->ipc, &hdr, hdr.size,
                                         &ipc_reply, sizeof(ipc_reply));
                if (ret < 0)
                        dev_err(sdev->dev, "DMA_TRACE_FREE failed with error: %d\n", ret);