Commit c1407ac1 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Mathieu Poirier

remoteproc: mtk_scp: Use devm variant of rproc_alloc()

To simplify the probe function, switch from using rproc_alloc() to
devm_rproc_alloc(); while at it, also put everything on a single line,
as it acceptably fits in 82 columns.
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220124120915.41292-1-angelogioacchino.delregno@collabora.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 26291c54
...@@ -756,11 +756,7 @@ static int scp_probe(struct platform_device *pdev) ...@@ -756,11 +756,7 @@ static int scp_probe(struct platform_device *pdev)
char *fw_name = "scp.img"; char *fw_name = "scp.img";
int ret, i; int ret, i;
rproc = rproc_alloc(dev, rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
np->name,
&scp_ops,
fw_name,
sizeof(*scp));
if (!rproc) { if (!rproc) {
dev_err(dev, "unable to allocate remoteproc\n"); dev_err(dev, "unable to allocate remoteproc\n");
return -ENOMEM; return -ENOMEM;
...@@ -776,8 +772,7 @@ static int scp_probe(struct platform_device *pdev) ...@@ -776,8 +772,7 @@ static int scp_probe(struct platform_device *pdev)
scp->sram_base = devm_ioremap_resource(dev, res); scp->sram_base = devm_ioremap_resource(dev, res);
if (IS_ERR((__force void *)scp->sram_base)) { if (IS_ERR((__force void *)scp->sram_base)) {
dev_err(dev, "Failed to parse and map sram memory\n"); dev_err(dev, "Failed to parse and map sram memory\n");
ret = PTR_ERR((__force void *)scp->sram_base); return PTR_ERR((__force void *)scp->sram_base);
goto free_rproc;
} }
scp->sram_size = resource_size(res); scp->sram_size = resource_size(res);
scp->sram_phys = res->start; scp->sram_phys = res->start;
...@@ -789,7 +784,7 @@ static int scp_probe(struct platform_device *pdev) ...@@ -789,7 +784,7 @@ static int scp_probe(struct platform_device *pdev)
ret = PTR_ERR((__force void *)scp->l1tcm_base); ret = PTR_ERR((__force void *)scp->l1tcm_base);
if (ret != -EINVAL) { if (ret != -EINVAL) {
dev_err(dev, "Failed to map l1tcm memory\n"); dev_err(dev, "Failed to map l1tcm memory\n");
goto free_rproc; return ret;
} }
} else { } else {
scp->l1tcm_size = resource_size(res); scp->l1tcm_size = resource_size(res);
...@@ -851,8 +846,6 @@ static int scp_probe(struct platform_device *pdev) ...@@ -851,8 +846,6 @@ static int scp_probe(struct platform_device *pdev)
for (i = 0; i < SCP_IPI_MAX; i++) for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock); mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock); mutex_destroy(&scp->send_lock);
free_rproc:
rproc_free(rproc);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment