ASoC: SOF: core: check for mandatory fw_ready op during SOF probe
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Fri, 27 Sep 2019 20:05:32 +0000 (15:05 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 1 Oct 2019 17:34:50 +0000 (18:34 +0100)
fw_ready should be a mandatory op. Make sure fw_ready ops is set
during probe.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190927200538.660-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/core.c
sound/soc/sof/ipc.c
sound/soc/sof/sof-priv.h

index 15167b8220ed91b71f627bdfc5fbb65e50d77e77..5998861a90029353e752946d50951e46970dcd5b 100644 (file)
@@ -466,7 +466,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
        if (!sof_ops(sdev) || !sof_ops(sdev)->probe || !sof_ops(sdev)->run ||
            !sof_ops(sdev)->block_read || !sof_ops(sdev)->block_write ||
            !sof_ops(sdev)->send_msg || !sof_ops(sdev)->load_firmware ||
-           !sof_ops(sdev)->ipc_msg_data || !sof_ops(sdev)->ipc_pcm_params)
+           !sof_ops(sdev)->ipc_msg_data || !sof_ops(sdev)->ipc_pcm_params ||
+           !sof_ops(sdev)->fw_ready)
                return -EINVAL;
 
        INIT_LIST_HEAD(&sdev->pcm_list);
index b946c81197a1d5c32f3699e6374dbfb661120362..26675dfe02404965c954cc80045b7b2149536e65 100644 (file)
@@ -792,12 +792,6 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)
        struct snd_sof_ipc *ipc;
        struct snd_sof_ipc_msg *msg;
 
-       /* check if mandatory ops required for ipc are defined */
-       if (!sof_ops(sdev)->fw_ready) {
-               dev_err(sdev->dev, "error: ipc mandatory ops not defined\n");
-               return NULL;
-       }
-
        ipc = devm_kzalloc(sdev->dev, sizeof(*ipc), GFP_KERNEL);
        if (!ipc)
                return NULL;
index 348759035dd035b9888501e18fc9e378e30a6b14..44f789bf7fb06ab955c8b61df8e092d83c4144c9 100644 (file)
@@ -133,7 +133,7 @@ struct snd_sof_dsp_ops {
         * FW ready checks for ABI compatibility and creates
         * memory windows at first boot
         */
-       int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* optional */
+       int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* mandatory */
 
        /* connect pcm substream to a host stream */
        int (*pcm_open)(struct snd_sof_dev *sdev,