summaryrefslogtreecommitdiff
path: root/sound/soc/sof/sof-client-ipc-msg-injector.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2022-05-06 16:26:41 +0300
committerMark Brown <broonie@kernel.org>2022-05-09 18:17:56 +0100
commitef368c3347fe79a4193317b130b02064801920d7 (patch)
tree7b1835bd4fc648f745f2d1ffd6a2677346b21180 /sound/soc/sof/sof-client-ipc-msg-injector.c
parenta669ec5f4bc485a56b2f379e7c7197a810872cc1 (diff)
ASoC: SOF: ipc-msg-injector: Query the maximum IPC payload size
Instead of using the SOF_IPC_MSG_MAX_SIZE as the maximum payload size for and IPC message, use the provided API to query it. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220506132647.18690-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/sof-client-ipc-msg-injector.c')
-rw-r--r--sound/soc/sof/sof-client-ipc-msg-injector.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c
index c711981187aa..19bb6212cb56 100644
--- a/sound/soc/sof/sof-client-ipc-msg-injector.c
+++ b/sound/soc/sof/sof-client-ipc-msg-injector.c
@@ -22,6 +22,7 @@
struct sof_msg_inject_priv {
struct dentry *dfs_file;
+ size_t max_msg_size;
void *tx_buffer;
void *rx_buffer;
@@ -78,7 +79,7 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu
if (*ppos)
return 0;
- size = simple_write_to_buffer(priv->tx_buffer, SOF_IPC_MSG_MAX_SIZE,
+ size = simple_write_to_buffer(priv->tx_buffer, priv->max_msg_size,
ppos, buffer, count);
if (size != count)
return size > 0 ? -EFAULT : size;
@@ -90,9 +91,9 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu
}
/* send the message */
- memset(priv->rx_buffer, 0, SOF_IPC_MSG_MAX_SIZE);
+ memset(priv->rx_buffer, 0, priv->max_msg_size);
ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer, priv->rx_buffer,
- SOF_IPC_MSG_MAX_SIZE);
+ priv->max_msg_size);
pm_runtime_mark_last_busy(dev);
err = pm_runtime_put_autosuspend(dev);
if (err < 0)
@@ -135,8 +136,9 @@ static int sof_msg_inject_probe(struct auxiliary_device *auxdev,
if (!priv)
return -ENOMEM;
- priv->tx_buffer = devm_kmalloc(dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
- priv->rx_buffer = devm_kzalloc(dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
+ priv->max_msg_size = sof_client_get_ipc_max_payload_size(cdev);
+ priv->tx_buffer = devm_kmalloc(dev, priv->max_msg_size, GFP_KERNEL);
+ priv->rx_buffer = devm_kzalloc(dev, priv->max_msg_size, GFP_KERNEL);
if (!priv->tx_buffer || !priv->rx_buffer)
return -ENOMEM;