summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2022-06-23 14:17:01 +0200
committerMatthias Brugger <matthias.bgg@gmail.com>2022-07-08 10:29:17 +0200
commit4d3ddc9bce4b2bfc167d8c2880f34de29b4587c6 (patch)
tree4abdf6788a88f59f23d7962fa5c050c998573de6 /drivers/soc
parent2b5764fb7bf8e22c9e853eb58865df9d74f8f20a (diff)
soc: mediatek: mutex: Simplify with devm_platform_get_and_ioremap_resource()
Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. While at it, also remove a redundant call to of_address_to_resource(), as this was getting the address of the same resource index 0: we can as well get the iostart from the 'regs' pointer. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220623121701.107512-1-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/mediatek/mtk-mutex.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
index 2fd8318c3bdc..5ea43de4e410 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -750,7 +750,7 @@ static int mtk_mutex_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct mtk_mutex_ctx *mtx;
- struct resource *regs, addr;
+ struct resource *regs;
int i;
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
int ret;
@@ -774,11 +774,12 @@ static int mtk_mutex_probe(struct platform_device *pdev)
}
}
- if (of_address_to_resource(dev->of_node, 0, &addr) < 0) {
- dev_err(dev, "Failed to get addr\n");
- return -EINVAL;
+ mtx->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs);
+ if (IS_ERR(mtx->regs)) {
+ dev_err(dev, "Failed to map mutex registers\n");
+ return PTR_ERR(mtx->regs);
}
- mtx->addr = addr.start;
+ mtx->addr = regs->start;
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
ret = cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0);
@@ -786,13 +787,6 @@ static int mtk_mutex_probe(struct platform_device *pdev)
dev_dbg(dev, "No mediatek,gce-client-reg!\n");
#endif
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mtx->regs = devm_ioremap_resource(dev, regs);
- if (IS_ERR(mtx->regs)) {
- dev_err(dev, "Failed to map mutex registers\n");
- return PTR_ERR(mtx->regs);
- }
-
platform_set_drvdata(pdev, mtx);
return 0;