drm/mediatek: Use devm_platform_ioremap_resource()
authorYang Li <yang.lee@linux.alibaba.com>
Wed, 12 Apr 2023 06:46:33 +0000 (14:46 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Thu, 7 Dec 2023 15:58:02 +0000 (15:58 +0000)
Remove variable 'res' and convert platform_get_resource(),
devm_ioremap_resource() to a single call to
devm_platform_ioremap_resource(), as this is exactly what this function
does.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230412064635.41315-1-yang.lee@linux.alibaba.com/
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230412064635.41315-2-yang.lee@linux.alibaba.com/
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230412064635.41315-3-yang.lee@linux.alibaba.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_cec.c
drivers/gpu/drm/mediatek/mtk_disp_aal.c
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c

index f47f417d8ba673b4d407c311d0079acb5f9c7d74..8519e9bade361cd8ce2d9b464e4933e655b2e085 100644 (file)
@@ -185,7 +185,6 @@ static int mtk_cec_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct mtk_cec *cec;
-       struct resource *res;
        int ret;
 
        cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL);
@@ -195,8 +194,7 @@ static int mtk_cec_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, cec);
        spin_lock_init(&cec->lock);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       cec->regs = devm_ioremap_resource(dev, res);
+       cec->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(cec->regs)) {
                ret = PTR_ERR(cec->regs);
                dev_err(dev, "Failed to ioremap cec: %d\n", ret);
index 2209159d885572f7d7165addc22a1552859b2386..40fe403086c3d40a36a16be09c22e7d3ae25367a 100644 (file)
@@ -168,7 +168,6 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct mtk_disp_aal *priv;
-       struct resource *res;
        int ret;
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
                return PTR_ERR(priv->clk);
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->regs = devm_ioremap_resource(dev, res);
+       priv->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->regs)) {
                dev_err(dev, "failed to ioremap aal\n");
                return PTR_ERR(priv->regs);
index 4234ff7485e884cea00c1069ba576cbb9bed9d48..465cddce0d3241531e65a88ba384d7cbed4a03a8 100644 (file)
@@ -153,7 +153,6 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct mtk_disp_ccorr *priv;
-       struct resource *res;
        int ret;
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -166,8 +165,7 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
                return PTR_ERR(priv->clk);
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->regs = devm_ioremap_resource(dev, res);
+       priv->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->regs)) {
                dev_err(dev, "failed to ioremap ccorr\n");
                return PTR_ERR(priv->regs);