* [PATCH 1/3] remoteproc: mtk_scp: Use devm variant of rproc_alloc()
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
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: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 36e48cf58ed6..95a40e3f11e3 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -756,11 +756,7 @@ static int scp_probe(struct platform_device *pdev)
char *fw_name = "scp.img";
int ret, i;
- rproc = rproc_alloc(dev,
- np->name,
- &scp_ops,
- fw_name,
- sizeof(*scp));
+ rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
if (!rproc) {
dev_err(dev, "unable to allocate remoteproc\n");
return -ENOMEM;
@@ -776,8 +772,7 @@ static int scp_probe(struct platform_device *pdev)
scp->sram_base = devm_ioremap_resource(dev, res);
if (IS_ERR((__force void *)scp->sram_base)) {
dev_err(dev, "Failed to parse and map sram memory\n");
- ret = PTR_ERR((__force void *)scp->sram_base);
- goto free_rproc;
+ return PTR_ERR((__force void *)scp->sram_base);
}
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
@@ -789,7 +784,7 @@ static int scp_probe(struct platform_device *pdev)
ret = PTR_ERR((__force void *)scp->l1tcm_base);
if (ret != -EINVAL) {
dev_err(dev, "Failed to map l1tcm memory\n");
- goto free_rproc;
+ return ret;
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -851,8 +846,6 @@ static int scp_probe(struct platform_device *pdev)
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
-free_rproc:
- rproc_free(rproc);
return ret;
}
--
2.33.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] remoteproc: mtk_scp: Use devm variant of rproc_alloc()
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
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: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 36e48cf58ed6..95a40e3f11e3 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -756,11 +756,7 @@ static int scp_probe(struct platform_device *pdev)
char *fw_name = "scp.img";
int ret, i;
- rproc = rproc_alloc(dev,
- np->name,
- &scp_ops,
- fw_name,
- sizeof(*scp));
+ rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
if (!rproc) {
dev_err(dev, "unable to allocate remoteproc\n");
return -ENOMEM;
@@ -776,8 +772,7 @@ static int scp_probe(struct platform_device *pdev)
scp->sram_base = devm_ioremap_resource(dev, res);
if (IS_ERR((__force void *)scp->sram_base)) {
dev_err(dev, "Failed to parse and map sram memory\n");
- ret = PTR_ERR((__force void *)scp->sram_base);
- goto free_rproc;
+ return PTR_ERR((__force void *)scp->sram_base);
}
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
@@ -789,7 +784,7 @@ static int scp_probe(struct platform_device *pdev)
ret = PTR_ERR((__force void *)scp->l1tcm_base);
if (ret != -EINVAL) {
dev_err(dev, "Failed to map l1tcm memory\n");
- goto free_rproc;
+ return ret;
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -851,8 +846,6 @@ static int scp_probe(struct platform_device *pdev)
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
-free_rproc:
- rproc_free(rproc);
return ret;
}
--
2.33.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] remoteproc: mtk_scp: Use devm variant of rproc_alloc()
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
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: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 36e48cf58ed6..95a40e3f11e3 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -756,11 +756,7 @@ static int scp_probe(struct platform_device *pdev)
char *fw_name = "scp.img";
int ret, i;
- rproc = rproc_alloc(dev,
- np->name,
- &scp_ops,
- fw_name,
- sizeof(*scp));
+ rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
if (!rproc) {
dev_err(dev, "unable to allocate remoteproc\n");
return -ENOMEM;
@@ -776,8 +772,7 @@ static int scp_probe(struct platform_device *pdev)
scp->sram_base = devm_ioremap_resource(dev, res);
if (IS_ERR((__force void *)scp->sram_base)) {
dev_err(dev, "Failed to parse and map sram memory\n");
- ret = PTR_ERR((__force void *)scp->sram_base);
- goto free_rproc;
+ return PTR_ERR((__force void *)scp->sram_base);
}
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
@@ -789,7 +784,7 @@ static int scp_probe(struct platform_device *pdev)
ret = PTR_ERR((__force void *)scp->l1tcm_base);
if (ret != -EINVAL) {
dev_err(dev, "Failed to map l1tcm memory\n");
- goto free_rproc;
+ return ret;
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -851,8 +846,6 @@ static int scp_probe(struct platform_device *pdev)
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
-free_rproc:
- rproc_free(rproc);
return ret;
}
--
2.33.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] remoteproc: mtk_scp: Reorder scp_probe() sequence
2022-01-24 12:09 ` AngeloGioacchino Del Regno
(?)
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
-1 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Cleanup the scp_probe() function by reordering some calls in this
function, useful to reduce the usage of goto(s), and preparing
for one more usage of dev_err_probe().
In particular, we can get the clocks before mapping the memory region,
and move the mutexes initialization right before registering the ipi
handler (which is the first mutex user in this driver).
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 95a40e3f11e3..e40706b0e015 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -791,24 +791,23 @@ static int scp_probe(struct platform_device *pdev)
scp->l1tcm_phys = res->start;
}
- mutex_init(&scp->send_lock);
- for (i = 0; i < SCP_IPI_MAX; i++)
- mutex_init(&scp->ipi_desc[i].lock);
-
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
if (IS_ERR((__force void *)scp->reg_base)) {
dev_err(dev, "Failed to parse and map cfg memory\n");
- ret = PTR_ERR((__force void *)scp->reg_base);
- goto destroy_mutex;
+ return PTR_ERR((__force void *)scp->reg_base);
}
- ret = scp_map_memory_region(scp);
+ ret = scp->data->scp_clk_get(scp);
if (ret)
- goto destroy_mutex;
+ return ret;
- ret = scp->data->scp_clk_get(scp);
+ ret = scp_map_memory_region(scp);
if (ret)
- goto release_dev_mem;
+ return ret;
+
+ mutex_init(&scp->send_lock);
+ for (i = 0; i < SCP_IPI_MAX; i++)
+ mutex_init(&scp->ipi_desc[i].lock);
/* register SCP initialization IPI */
ret = scp_ipi_register(scp, SCP_IPI_INIT, scp_init_ipi_handler, scp);
@@ -842,7 +841,6 @@ static int scp_probe(struct platform_device *pdev)
scp_ipi_unregister(scp, SCP_IPI_INIT);
release_dev_mem:
scp_unmap_memory_region(scp);
-destroy_mutex:
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
--
2.33.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] remoteproc: mtk_scp: Reorder scp_probe() sequence
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Cleanup the scp_probe() function by reordering some calls in this
function, useful to reduce the usage of goto(s), and preparing
for one more usage of dev_err_probe().
In particular, we can get the clocks before mapping the memory region,
and move the mutexes initialization right before registering the ipi
handler (which is the first mutex user in this driver).
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 95a40e3f11e3..e40706b0e015 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -791,24 +791,23 @@ static int scp_probe(struct platform_device *pdev)
scp->l1tcm_phys = res->start;
}
- mutex_init(&scp->send_lock);
- for (i = 0; i < SCP_IPI_MAX; i++)
- mutex_init(&scp->ipi_desc[i].lock);
-
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
if (IS_ERR((__force void *)scp->reg_base)) {
dev_err(dev, "Failed to parse and map cfg memory\n");
- ret = PTR_ERR((__force void *)scp->reg_base);
- goto destroy_mutex;
+ return PTR_ERR((__force void *)scp->reg_base);
}
- ret = scp_map_memory_region(scp);
+ ret = scp->data->scp_clk_get(scp);
if (ret)
- goto destroy_mutex;
+ return ret;
- ret = scp->data->scp_clk_get(scp);
+ ret = scp_map_memory_region(scp);
if (ret)
- goto release_dev_mem;
+ return ret;
+
+ mutex_init(&scp->send_lock);
+ for (i = 0; i < SCP_IPI_MAX; i++)
+ mutex_init(&scp->ipi_desc[i].lock);
/* register SCP initialization IPI */
ret = scp_ipi_register(scp, SCP_IPI_INIT, scp_init_ipi_handler, scp);
@@ -842,7 +841,6 @@ static int scp_probe(struct platform_device *pdev)
scp_ipi_unregister(scp, SCP_IPI_INIT);
release_dev_mem:
scp_unmap_memory_region(scp);
-destroy_mutex:
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
--
2.33.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] remoteproc: mtk_scp: Reorder scp_probe() sequence
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Cleanup the scp_probe() function by reordering some calls in this
function, useful to reduce the usage of goto(s), and preparing
for one more usage of dev_err_probe().
In particular, we can get the clocks before mapping the memory region,
and move the mutexes initialization right before registering the ipi
handler (which is the first mutex user in this driver).
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 95a40e3f11e3..e40706b0e015 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -791,24 +791,23 @@ static int scp_probe(struct platform_device *pdev)
scp->l1tcm_phys = res->start;
}
- mutex_init(&scp->send_lock);
- for (i = 0; i < SCP_IPI_MAX; i++)
- mutex_init(&scp->ipi_desc[i].lock);
-
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
if (IS_ERR((__force void *)scp->reg_base)) {
dev_err(dev, "Failed to parse and map cfg memory\n");
- ret = PTR_ERR((__force void *)scp->reg_base);
- goto destroy_mutex;
+ return PTR_ERR((__force void *)scp->reg_base);
}
- ret = scp_map_memory_region(scp);
+ ret = scp->data->scp_clk_get(scp);
if (ret)
- goto destroy_mutex;
+ return ret;
- ret = scp->data->scp_clk_get(scp);
+ ret = scp_map_memory_region(scp);
if (ret)
- goto release_dev_mem;
+ return ret;
+
+ mutex_init(&scp->send_lock);
+ for (i = 0; i < SCP_IPI_MAX; i++)
+ mutex_init(&scp->ipi_desc[i].lock);
/* register SCP initialization IPI */
ret = scp_ipi_register(scp, SCP_IPI_INIT, scp_init_ipi_handler, scp);
@@ -842,7 +841,6 @@ static int scp_probe(struct platform_device *pdev)
scp_ipi_unregister(scp, SCP_IPI_INIT);
release_dev_mem:
scp_unmap_memory_region(scp);
-destroy_mutex:
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_destroy(&scp->ipi_desc[i].lock);
mutex_destroy(&scp->send_lock);
--
2.33.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
2022-01-24 12:09 ` AngeloGioacchino Del Regno
(?)
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
-1 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Simplify the probe function, where possible, by using dev_err_probe().
While at it, as to increase human readability, also remove some
unnecessary forced void pointer casts that were previously used in
error checking.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index e40706b0e015..dcddb33e9997 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
int ret, i;
rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
- if (!rproc) {
- dev_err(dev, "unable to allocate remoteproc\n");
- return -ENOMEM;
- }
+ if (!rproc)
+ return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
scp = (struct mtk_scp *)rproc->priv;
scp->rproc = rproc;
@@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
scp->sram_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->sram_base)) {
- dev_err(dev, "Failed to parse and map sram memory\n");
- return PTR_ERR((__force void *)scp->sram_base);
- }
+ if (IS_ERR(scp->sram_base))
+ return dev_err_probe(dev, PTR_ERR(scp->sram_base),
+ "Failed to parse and map sram memory\n");
+
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
/* l1tcm is an optional memory region */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
scp->l1tcm_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->l1tcm_base)) {
- ret = PTR_ERR((__force void *)scp->l1tcm_base);
+ if (IS_ERR(scp->l1tcm_base)) {
+ ret = PTR_ERR(scp->l1tcm_base);
if (ret != -EINVAL) {
- dev_err(dev, "Failed to map l1tcm memory\n");
- return ret;
+ return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
}
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
- if (IS_ERR((__force void *)scp->reg_base)) {
- dev_err(dev, "Failed to parse and map cfg memory\n");
- return PTR_ERR((__force void *)scp->reg_base);
- }
+ if (IS_ERR(scp->reg_base))
+ return dev_err_probe(dev, PTR_ERR(scp->reg_base),
+ "Failed to parse and map cfg memory\n");
ret = scp->data->scp_clk_get(scp);
if (ret)
--
2.33.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Simplify the probe function, where possible, by using dev_err_probe().
While at it, as to increase human readability, also remove some
unnecessary forced void pointer casts that were previously used in
error checking.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index e40706b0e015..dcddb33e9997 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
int ret, i;
rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
- if (!rproc) {
- dev_err(dev, "unable to allocate remoteproc\n");
- return -ENOMEM;
- }
+ if (!rproc)
+ return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
scp = (struct mtk_scp *)rproc->priv;
scp->rproc = rproc;
@@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
scp->sram_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->sram_base)) {
- dev_err(dev, "Failed to parse and map sram memory\n");
- return PTR_ERR((__force void *)scp->sram_base);
- }
+ if (IS_ERR(scp->sram_base))
+ return dev_err_probe(dev, PTR_ERR(scp->sram_base),
+ "Failed to parse and map sram memory\n");
+
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
/* l1tcm is an optional memory region */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
scp->l1tcm_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->l1tcm_base)) {
- ret = PTR_ERR((__force void *)scp->l1tcm_base);
+ if (IS_ERR(scp->l1tcm_base)) {
+ ret = PTR_ERR(scp->l1tcm_base);
if (ret != -EINVAL) {
- dev_err(dev, "Failed to map l1tcm memory\n");
- return ret;
+ return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
}
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
- if (IS_ERR((__force void *)scp->reg_base)) {
- dev_err(dev, "Failed to parse and map cfg memory\n");
- return PTR_ERR((__force void *)scp->reg_base);
- }
+ if (IS_ERR(scp->reg_base))
+ return dev_err_probe(dev, PTR_ERR(scp->reg_base),
+ "Failed to parse and map cfg memory\n");
ret = scp->data->scp_clk_get(scp);
if (ret)
--
2.33.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-01-24 12:09 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-24 12:09 UTC (permalink / raw)
To: bjorn.andersson
Cc: mathieu.poirier, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel,
AngeloGioacchino Del Regno
Simplify the probe function, where possible, by using dev_err_probe().
While at it, as to increase human readability, also remove some
unnecessary forced void pointer casts that were previously used in
error checking.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index e40706b0e015..dcddb33e9997 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
int ret, i;
rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
- if (!rproc) {
- dev_err(dev, "unable to allocate remoteproc\n");
- return -ENOMEM;
- }
+ if (!rproc)
+ return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
scp = (struct mtk_scp *)rproc->priv;
scp->rproc = rproc;
@@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
scp->sram_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->sram_base)) {
- dev_err(dev, "Failed to parse and map sram memory\n");
- return PTR_ERR((__force void *)scp->sram_base);
- }
+ if (IS_ERR(scp->sram_base))
+ return dev_err_probe(dev, PTR_ERR(scp->sram_base),
+ "Failed to parse and map sram memory\n");
+
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;
/* l1tcm is an optional memory region */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
scp->l1tcm_base = devm_ioremap_resource(dev, res);
- if (IS_ERR((__force void *)scp->l1tcm_base)) {
- ret = PTR_ERR((__force void *)scp->l1tcm_base);
+ if (IS_ERR(scp->l1tcm_base)) {
+ ret = PTR_ERR(scp->l1tcm_base);
if (ret != -EINVAL) {
- dev_err(dev, "Failed to map l1tcm memory\n");
- return ret;
+ return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
}
} else {
scp->l1tcm_size = resource_size(res);
@@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
}
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
- if (IS_ERR((__force void *)scp->reg_base)) {
- dev_err(dev, "Failed to parse and map cfg memory\n");
- return PTR_ERR((__force void *)scp->reg_base);
- }
+ if (IS_ERR(scp->reg_base))
+ return dev_err_probe(dev, PTR_ERR(scp->reg_base),
+ "Failed to parse and map cfg memory\n");
ret = scp->data->scp_clk_get(scp);
if (ret)
--
2.33.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
2022-01-24 12:09 ` AngeloGioacchino Del Regno
(?)
@ 2022-02-01 18:36 ` Mathieu Poirier
-1 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-01 18:36 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Hi Angelo,
On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> Simplify the probe function, where possible, by using dev_err_probe().
> While at it, as to increase human readability, also remove some
> unnecessary forced void pointer casts that were previously used in
> error checking.
I am in favour of all 3 patches (please add a cover letter next time) but weary
about testing - do you have access to a Mediatek platform to try this on or
is it purely theoretical?
I would definitely feel better to see a "Tested-by" tag by someone out there
with access to the HW.
Thanks,
Mathieu
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index e40706b0e015..dcddb33e9997 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> int ret, i;
>
> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> - if (!rproc) {
> - dev_err(dev, "unable to allocate remoteproc\n");
> - return -ENOMEM;
> - }
> + if (!rproc)
> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>
> scp = (struct mtk_scp *)rproc->priv;
> scp->rproc = rproc;
> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> scp->sram_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->sram_base)) {
> - dev_err(dev, "Failed to parse and map sram memory\n");
> - return PTR_ERR((__force void *)scp->sram_base);
> - }
> + if (IS_ERR(scp->sram_base))
> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> + "Failed to parse and map sram memory\n");
> +
> scp->sram_size = resource_size(res);
> scp->sram_phys = res->start;
>
> /* l1tcm is an optional memory region */
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> + if (IS_ERR(scp->l1tcm_base)) {
> + ret = PTR_ERR(scp->l1tcm_base);
> if (ret != -EINVAL) {
> - dev_err(dev, "Failed to map l1tcm memory\n");
> - return ret;
> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> }
> } else {
> scp->l1tcm_size = resource_size(res);
> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> }
>
> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> - if (IS_ERR((__force void *)scp->reg_base)) {
> - dev_err(dev, "Failed to parse and map cfg memory\n");
> - return PTR_ERR((__force void *)scp->reg_base);
> - }
> + if (IS_ERR(scp->reg_base))
> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> + "Failed to parse and map cfg memory\n");
>
> ret = scp->data->scp_clk_get(scp);
> if (ret)
> --
> 2.33.1
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-01 18:36 ` Mathieu Poirier
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-01 18:36 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Hi Angelo,
On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> Simplify the probe function, where possible, by using dev_err_probe().
> While at it, as to increase human readability, also remove some
> unnecessary forced void pointer casts that were previously used in
> error checking.
I am in favour of all 3 patches (please add a cover letter next time) but weary
about testing - do you have access to a Mediatek platform to try this on or
is it purely theoretical?
I would definitely feel better to see a "Tested-by" tag by someone out there
with access to the HW.
Thanks,
Mathieu
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index e40706b0e015..dcddb33e9997 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> int ret, i;
>
> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> - if (!rproc) {
> - dev_err(dev, "unable to allocate remoteproc\n");
> - return -ENOMEM;
> - }
> + if (!rproc)
> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>
> scp = (struct mtk_scp *)rproc->priv;
> scp->rproc = rproc;
> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> scp->sram_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->sram_base)) {
> - dev_err(dev, "Failed to parse and map sram memory\n");
> - return PTR_ERR((__force void *)scp->sram_base);
> - }
> + if (IS_ERR(scp->sram_base))
> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> + "Failed to parse and map sram memory\n");
> +
> scp->sram_size = resource_size(res);
> scp->sram_phys = res->start;
>
> /* l1tcm is an optional memory region */
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> + if (IS_ERR(scp->l1tcm_base)) {
> + ret = PTR_ERR(scp->l1tcm_base);
> if (ret != -EINVAL) {
> - dev_err(dev, "Failed to map l1tcm memory\n");
> - return ret;
> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> }
> } else {
> scp->l1tcm_size = resource_size(res);
> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> }
>
> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> - if (IS_ERR((__force void *)scp->reg_base)) {
> - dev_err(dev, "Failed to parse and map cfg memory\n");
> - return PTR_ERR((__force void *)scp->reg_base);
> - }
> + if (IS_ERR(scp->reg_base))
> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> + "Failed to parse and map cfg memory\n");
>
> ret = scp->data->scp_clk_get(scp);
> if (ret)
> --
> 2.33.1
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-01 18:36 ` Mathieu Poirier
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-01 18:36 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Hi Angelo,
On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> Simplify the probe function, where possible, by using dev_err_probe().
> While at it, as to increase human readability, also remove some
> unnecessary forced void pointer casts that were previously used in
> error checking.
I am in favour of all 3 patches (please add a cover letter next time) but weary
about testing - do you have access to a Mediatek platform to try this on or
is it purely theoretical?
I would definitely feel better to see a "Tested-by" tag by someone out there
with access to the HW.
Thanks,
Mathieu
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index e40706b0e015..dcddb33e9997 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> int ret, i;
>
> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> - if (!rproc) {
> - dev_err(dev, "unable to allocate remoteproc\n");
> - return -ENOMEM;
> - }
> + if (!rproc)
> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>
> scp = (struct mtk_scp *)rproc->priv;
> scp->rproc = rproc;
> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> scp->sram_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->sram_base)) {
> - dev_err(dev, "Failed to parse and map sram memory\n");
> - return PTR_ERR((__force void *)scp->sram_base);
> - }
> + if (IS_ERR(scp->sram_base))
> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> + "Failed to parse and map sram memory\n");
> +
> scp->sram_size = resource_size(res);
> scp->sram_phys = res->start;
>
> /* l1tcm is an optional memory region */
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> + if (IS_ERR(scp->l1tcm_base)) {
> + ret = PTR_ERR(scp->l1tcm_base);
> if (ret != -EINVAL) {
> - dev_err(dev, "Failed to map l1tcm memory\n");
> - return ret;
> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> }
> } else {
> scp->l1tcm_size = resource_size(res);
> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> }
>
> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> - if (IS_ERR((__force void *)scp->reg_base)) {
> - dev_err(dev, "Failed to parse and map cfg memory\n");
> - return PTR_ERR((__force void *)scp->reg_base);
> - }
> + if (IS_ERR(scp->reg_base))
> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> + "Failed to parse and map cfg memory\n");
>
> ret = scp->data->scp_clk_get(scp);
> if (ret)
> --
> 2.33.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
2022-02-01 18:36 ` Mathieu Poirier
(?)
@ 2022-02-02 9:03 ` AngeloGioacchino Del Regno
-1 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-02-02 9:03 UTC (permalink / raw)
To: Mathieu Poirier
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> Hi Angelo,
>
> On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
>> Simplify the probe function, where possible, by using dev_err_probe().
>> While at it, as to increase human readability, also remove some
>> unnecessary forced void pointer casts that were previously used in
>> error checking.
>
> I am in favour of all 3 patches (please add a cover letter next time) but weary
> about testing - do you have access to a Mediatek platform to try this on or
> is it purely theoretical?
>
> I would definitely feel better to see a "Tested-by" tag by someone out there
> with access to the HW.
>
> Thanks,
> Mathieu
>
Hello Mathieu,
I have multiple MediaTek platforms and I always test on all of them before
pushing such commits upstream, so, even though this kind of patch is trivial,
this is *not* purely theoretical and I confirm that this was successfully tested.
Regards,
Angelo
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
>> 1 file changed, 12 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
>> index e40706b0e015..dcddb33e9997 100644
>> --- a/drivers/remoteproc/mtk_scp.c
>> +++ b/drivers/remoteproc/mtk_scp.c
>> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
>> int ret, i;
>>
>> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
>> - if (!rproc) {
>> - dev_err(dev, "unable to allocate remoteproc\n");
>> - return -ENOMEM;
>> - }
>> + if (!rproc)
>> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>>
>> scp = (struct mtk_scp *)rproc->priv;
>> scp->rproc = rproc;
>> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>>
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
>> scp->sram_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->sram_base)) {
>> - dev_err(dev, "Failed to parse and map sram memory\n");
>> - return PTR_ERR((__force void *)scp->sram_base);
>> - }
>> + if (IS_ERR(scp->sram_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
>> + "Failed to parse and map sram memory\n");
>> +
>> scp->sram_size = resource_size(res);
>> scp->sram_phys = res->start;
>>
>> /* l1tcm is an optional memory region */
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
>> scp->l1tcm_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
>> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
>> + if (IS_ERR(scp->l1tcm_base)) {
>> + ret = PTR_ERR(scp->l1tcm_base);
>> if (ret != -EINVAL) {
>> - dev_err(dev, "Failed to map l1tcm memory\n");
>> - return ret;
>> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
>> }
>> } else {
>> scp->l1tcm_size = resource_size(res);
>> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
>> }
>>
>> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
>> - if (IS_ERR((__force void *)scp->reg_base)) {
>> - dev_err(dev, "Failed to parse and map cfg memory\n");
>> - return PTR_ERR((__force void *)scp->reg_base);
>> - }
>> + if (IS_ERR(scp->reg_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
>> + "Failed to parse and map cfg memory\n");
>>
>> ret = scp->data->scp_clk_get(scp);
>> if (ret)
>> --
>> 2.33.1
>>
--
AngeloGioacchino Del Regno
Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-02 9:03 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-02-02 9:03 UTC (permalink / raw)
To: Mathieu Poirier
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> Hi Angelo,
>
> On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
>> Simplify the probe function, where possible, by using dev_err_probe().
>> While at it, as to increase human readability, also remove some
>> unnecessary forced void pointer casts that were previously used in
>> error checking.
>
> I am in favour of all 3 patches (please add a cover letter next time) but weary
> about testing - do you have access to a Mediatek platform to try this on or
> is it purely theoretical?
>
> I would definitely feel better to see a "Tested-by" tag by someone out there
> with access to the HW.
>
> Thanks,
> Mathieu
>
Hello Mathieu,
I have multiple MediaTek platforms and I always test on all of them before
pushing such commits upstream, so, even though this kind of patch is trivial,
this is *not* purely theoretical and I confirm that this was successfully tested.
Regards,
Angelo
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
>> 1 file changed, 12 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
>> index e40706b0e015..dcddb33e9997 100644
>> --- a/drivers/remoteproc/mtk_scp.c
>> +++ b/drivers/remoteproc/mtk_scp.c
>> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
>> int ret, i;
>>
>> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
>> - if (!rproc) {
>> - dev_err(dev, "unable to allocate remoteproc\n");
>> - return -ENOMEM;
>> - }
>> + if (!rproc)
>> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>>
>> scp = (struct mtk_scp *)rproc->priv;
>> scp->rproc = rproc;
>> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>>
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
>> scp->sram_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->sram_base)) {
>> - dev_err(dev, "Failed to parse and map sram memory\n");
>> - return PTR_ERR((__force void *)scp->sram_base);
>> - }
>> + if (IS_ERR(scp->sram_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
>> + "Failed to parse and map sram memory\n");
>> +
>> scp->sram_size = resource_size(res);
>> scp->sram_phys = res->start;
>>
>> /* l1tcm is an optional memory region */
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
>> scp->l1tcm_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
>> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
>> + if (IS_ERR(scp->l1tcm_base)) {
>> + ret = PTR_ERR(scp->l1tcm_base);
>> if (ret != -EINVAL) {
>> - dev_err(dev, "Failed to map l1tcm memory\n");
>> - return ret;
>> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
>> }
>> } else {
>> scp->l1tcm_size = resource_size(res);
>> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
>> }
>>
>> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
>> - if (IS_ERR((__force void *)scp->reg_base)) {
>> - dev_err(dev, "Failed to parse and map cfg memory\n");
>> - return PTR_ERR((__force void *)scp->reg_base);
>> - }
>> + if (IS_ERR(scp->reg_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
>> + "Failed to parse and map cfg memory\n");
>>
>> ret = scp->data->scp_clk_get(scp);
>> if (ret)
>> --
>> 2.33.1
>>
--
AngeloGioacchino Del Regno
Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-02 9:03 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-02-02 9:03 UTC (permalink / raw)
To: Mathieu Poirier
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> Hi Angelo,
>
> On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
>> Simplify the probe function, where possible, by using dev_err_probe().
>> While at it, as to increase human readability, also remove some
>> unnecessary forced void pointer casts that were previously used in
>> error checking.
>
> I am in favour of all 3 patches (please add a cover letter next time) but weary
> about testing - do you have access to a Mediatek platform to try this on or
> is it purely theoretical?
>
> I would definitely feel better to see a "Tested-by" tag by someone out there
> with access to the HW.
>
> Thanks,
> Mathieu
>
Hello Mathieu,
I have multiple MediaTek platforms and I always test on all of them before
pushing such commits upstream, so, even though this kind of patch is trivial,
this is *not* purely theoretical and I confirm that this was successfully tested.
Regards,
Angelo
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
>> 1 file changed, 12 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
>> index e40706b0e015..dcddb33e9997 100644
>> --- a/drivers/remoteproc/mtk_scp.c
>> +++ b/drivers/remoteproc/mtk_scp.c
>> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
>> int ret, i;
>>
>> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
>> - if (!rproc) {
>> - dev_err(dev, "unable to allocate remoteproc\n");
>> - return -ENOMEM;
>> - }
>> + if (!rproc)
>> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>>
>> scp = (struct mtk_scp *)rproc->priv;
>> scp->rproc = rproc;
>> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>>
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
>> scp->sram_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->sram_base)) {
>> - dev_err(dev, "Failed to parse and map sram memory\n");
>> - return PTR_ERR((__force void *)scp->sram_base);
>> - }
>> + if (IS_ERR(scp->sram_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
>> + "Failed to parse and map sram memory\n");
>> +
>> scp->sram_size = resource_size(res);
>> scp->sram_phys = res->start;
>>
>> /* l1tcm is an optional memory region */
>> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
>> scp->l1tcm_base = devm_ioremap_resource(dev, res);
>> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
>> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
>> + if (IS_ERR(scp->l1tcm_base)) {
>> + ret = PTR_ERR(scp->l1tcm_base);
>> if (ret != -EINVAL) {
>> - dev_err(dev, "Failed to map l1tcm memory\n");
>> - return ret;
>> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
>> }
>> } else {
>> scp->l1tcm_size = resource_size(res);
>> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
>> }
>>
>> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
>> - if (IS_ERR((__force void *)scp->reg_base)) {
>> - dev_err(dev, "Failed to parse and map cfg memory\n");
>> - return PTR_ERR((__force void *)scp->reg_base);
>> - }
>> + if (IS_ERR(scp->reg_base))
>> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
>> + "Failed to parse and map cfg memory\n");
>>
>> ret = scp->data->scp_clk_get(scp);
>> if (ret)
>> --
>> 2.33.1
>>
--
AngeloGioacchino Del Regno
Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
2022-02-02 9:03 ` AngeloGioacchino Del Regno
(?)
@ 2022-02-02 17:53 ` Mathieu Poirier
-1 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-02 17:53 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
On Wed, 2 Feb 2022 at 02:03, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> > Hi Angelo,
> >
> > On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> >> Simplify the probe function, where possible, by using dev_err_probe().
> >> While at it, as to increase human readability, also remove some
> >> unnecessary forced void pointer casts that were previously used in
> >> error checking.
> >
> > I am in favour of all 3 patches (please add a cover letter next time) but weary
> > about testing - do you have access to a Mediatek platform to try this on or
> > is it purely theoretical?
> >
> > I would definitely feel better to see a "Tested-by" tag by someone out there
> > with access to the HW.
> >
> > Thanks,
> > Mathieu
> >
>
> Hello Mathieu,
>
> I have multiple MediaTek platforms and I always test on all of them before
> pushing such commits upstream, so, even though this kind of patch is trivial,
> this is *not* purely theoretical and I confirm that this was successfully tested.
I have applied all 3 patches.
>
> Regards,
> Angelo
>
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> >> 1 file changed, 12 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> >> index e40706b0e015..dcddb33e9997 100644
> >> --- a/drivers/remoteproc/mtk_scp.c
> >> +++ b/drivers/remoteproc/mtk_scp.c
> >> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> >> int ret, i;
> >>
> >> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> >> - if (!rproc) {
> >> - dev_err(dev, "unable to allocate remoteproc\n");
> >> - return -ENOMEM;
> >> - }
> >> + if (!rproc)
> >> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
> >>
> >> scp = (struct mtk_scp *)rproc->priv;
> >> scp->rproc = rproc;
> >> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
> >>
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> >> scp->sram_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->sram_base)) {
> >> - dev_err(dev, "Failed to parse and map sram memory\n");
> >> - return PTR_ERR((__force void *)scp->sram_base);
> >> - }
> >> + if (IS_ERR(scp->sram_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> >> + "Failed to parse and map sram memory\n");
> >> +
> >> scp->sram_size = resource_size(res);
> >> scp->sram_phys = res->start;
> >>
> >> /* l1tcm is an optional memory region */
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> >> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> >> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> >> + if (IS_ERR(scp->l1tcm_base)) {
> >> + ret = PTR_ERR(scp->l1tcm_base);
> >> if (ret != -EINVAL) {
> >> - dev_err(dev, "Failed to map l1tcm memory\n");
> >> - return ret;
> >> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> >> }
> >> } else {
> >> scp->l1tcm_size = resource_size(res);
> >> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> >> }
> >>
> >> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> >> - if (IS_ERR((__force void *)scp->reg_base)) {
> >> - dev_err(dev, "Failed to parse and map cfg memory\n");
> >> - return PTR_ERR((__force void *)scp->reg_base);
> >> - }
> >> + if (IS_ERR(scp->reg_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> >> + "Failed to parse and map cfg memory\n");
> >>
> >> ret = scp->data->scp_clk_get(scp);
> >> if (ret)
> >> --
> >> 2.33.1
> >>
>
>
> --
> AngeloGioacchino Del Regno
> Software Engineer
>
> Collabora Ltd.
> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
> Registered in England & Wales, no. 5513718
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-02 17:53 ` Mathieu Poirier
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-02 17:53 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
On Wed, 2 Feb 2022 at 02:03, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> > Hi Angelo,
> >
> > On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> >> Simplify the probe function, where possible, by using dev_err_probe().
> >> While at it, as to increase human readability, also remove some
> >> unnecessary forced void pointer casts that were previously used in
> >> error checking.
> >
> > I am in favour of all 3 patches (please add a cover letter next time) but weary
> > about testing - do you have access to a Mediatek platform to try this on or
> > is it purely theoretical?
> >
> > I would definitely feel better to see a "Tested-by" tag by someone out there
> > with access to the HW.
> >
> > Thanks,
> > Mathieu
> >
>
> Hello Mathieu,
>
> I have multiple MediaTek platforms and I always test on all of them before
> pushing such commits upstream, so, even though this kind of patch is trivial,
> this is *not* purely theoretical and I confirm that this was successfully tested.
I have applied all 3 patches.
>
> Regards,
> Angelo
>
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> >> 1 file changed, 12 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> >> index e40706b0e015..dcddb33e9997 100644
> >> --- a/drivers/remoteproc/mtk_scp.c
> >> +++ b/drivers/remoteproc/mtk_scp.c
> >> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> >> int ret, i;
> >>
> >> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> >> - if (!rproc) {
> >> - dev_err(dev, "unable to allocate remoteproc\n");
> >> - return -ENOMEM;
> >> - }
> >> + if (!rproc)
> >> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
> >>
> >> scp = (struct mtk_scp *)rproc->priv;
> >> scp->rproc = rproc;
> >> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
> >>
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> >> scp->sram_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->sram_base)) {
> >> - dev_err(dev, "Failed to parse and map sram memory\n");
> >> - return PTR_ERR((__force void *)scp->sram_base);
> >> - }
> >> + if (IS_ERR(scp->sram_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> >> + "Failed to parse and map sram memory\n");
> >> +
> >> scp->sram_size = resource_size(res);
> >> scp->sram_phys = res->start;
> >>
> >> /* l1tcm is an optional memory region */
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> >> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> >> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> >> + if (IS_ERR(scp->l1tcm_base)) {
> >> + ret = PTR_ERR(scp->l1tcm_base);
> >> if (ret != -EINVAL) {
> >> - dev_err(dev, "Failed to map l1tcm memory\n");
> >> - return ret;
> >> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> >> }
> >> } else {
> >> scp->l1tcm_size = resource_size(res);
> >> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> >> }
> >>
> >> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> >> - if (IS_ERR((__force void *)scp->reg_base)) {
> >> - dev_err(dev, "Failed to parse and map cfg memory\n");
> >> - return PTR_ERR((__force void *)scp->reg_base);
> >> - }
> >> + if (IS_ERR(scp->reg_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> >> + "Failed to parse and map cfg memory\n");
> >>
> >> ret = scp->data->scp_clk_get(scp);
> >> if (ret)
> >> --
> >> 2.33.1
> >>
>
>
> --
> AngeloGioacchino Del Regno
> Software Engineer
>
> Collabora Ltd.
> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
> Registered in England & Wales, no. 5513718
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
@ 2022-02-02 17:53 ` Mathieu Poirier
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Poirier @ 2022-02-02 17:53 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: bjorn.andersson, matthias.bgg, linux-remoteproc,
linux-arm-kernel, linux-mediatek, linux-kernel, kernel
On Wed, 2 Feb 2022 at 02:03, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 01/02/22 19:36, Mathieu Poirier ha scritto:
> > Hi Angelo,
> >
> > On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> >> Simplify the probe function, where possible, by using dev_err_probe().
> >> While at it, as to increase human readability, also remove some
> >> unnecessary forced void pointer casts that were previously used in
> >> error checking.
> >
> > I am in favour of all 3 patches (please add a cover letter next time) but weary
> > about testing - do you have access to a Mediatek platform to try this on or
> > is it purely theoretical?
> >
> > I would definitely feel better to see a "Tested-by" tag by someone out there
> > with access to the HW.
> >
> > Thanks,
> > Mathieu
> >
>
> Hello Mathieu,
>
> I have multiple MediaTek platforms and I always test on all of them before
> pushing such commits upstream, so, even though this kind of patch is trivial,
> this is *not* purely theoretical and I confirm that this was successfully tested.
I have applied all 3 patches.
>
> Regards,
> Angelo
>
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> >> 1 file changed, 12 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> >> index e40706b0e015..dcddb33e9997 100644
> >> --- a/drivers/remoteproc/mtk_scp.c
> >> +++ b/drivers/remoteproc/mtk_scp.c
> >> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> >> int ret, i;
> >>
> >> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> >> - if (!rproc) {
> >> - dev_err(dev, "unable to allocate remoteproc\n");
> >> - return -ENOMEM;
> >> - }
> >> + if (!rproc)
> >> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
> >>
> >> scp = (struct mtk_scp *)rproc->priv;
> >> scp->rproc = rproc;
> >> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
> >>
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> >> scp->sram_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->sram_base)) {
> >> - dev_err(dev, "Failed to parse and map sram memory\n");
> >> - return PTR_ERR((__force void *)scp->sram_base);
> >> - }
> >> + if (IS_ERR(scp->sram_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> >> + "Failed to parse and map sram memory\n");
> >> +
> >> scp->sram_size = resource_size(res);
> >> scp->sram_phys = res->start;
> >>
> >> /* l1tcm is an optional memory region */
> >> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> >> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> >> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> >> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> >> + if (IS_ERR(scp->l1tcm_base)) {
> >> + ret = PTR_ERR(scp->l1tcm_base);
> >> if (ret != -EINVAL) {
> >> - dev_err(dev, "Failed to map l1tcm memory\n");
> >> - return ret;
> >> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> >> }
> >> } else {
> >> scp->l1tcm_size = resource_size(res);
> >> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> >> }
> >>
> >> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> >> - if (IS_ERR((__force void *)scp->reg_base)) {
> >> - dev_err(dev, "Failed to parse and map cfg memory\n");
> >> - return PTR_ERR((__force void *)scp->reg_base);
> >> - }
> >> + if (IS_ERR(scp->reg_base))
> >> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> >> + "Failed to parse and map cfg memory\n");
> >>
> >> ret = scp->data->scp_clk_get(scp);
> >> if (ret)
> >> --
> >> 2.33.1
> >>
>
>
> --
> AngeloGioacchino Del Regno
> Software Engineer
>
> Collabora Ltd.
> Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
> Registered in England & Wales, no. 5513718
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-02-02 17:55 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 12:09 [PATCH 1/3] remoteproc: mtk_scp: Use devm variant of rproc_alloc() AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-01-24 12:09 ` [PATCH 2/3] remoteproc: mtk_scp: Reorder scp_probe() sequence AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-01-24 12:09 ` [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-01-24 12:09 ` AngeloGioacchino Del Regno
2022-02-01 18:36 ` Mathieu Poirier
2022-02-01 18:36 ` Mathieu Poirier
2022-02-01 18:36 ` Mathieu Poirier
2022-02-02 9:03 ` AngeloGioacchino Del Regno
2022-02-02 9:03 ` AngeloGioacchino Del Regno
2022-02-02 9:03 ` AngeloGioacchino Del Regno
2022-02-02 17:53 ` Mathieu Poirier
2022-02-02 17:53 ` Mathieu Poirier
2022-02-02 17:53 ` Mathieu Poirier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.