OSDN Git Service

clk: mediatek: mt8183: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Tue, 15 Oct 2019 12:14:21 +0000 (20:14 +0800)
committerStephen Boyd <sboyd@kernel.org>
Wed, 16 Oct 2019 23:17:40 +0000 (16:17 -0700)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lkml.kernel.org/r/20191015121421.26144-1-yuehaibing@huawei.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mt8183.c

index 51c8d5c..5046852 100644 (file)
@@ -1189,11 +1189,10 @@ CLK_OF_DECLARE_DRIVER(mt8183_topckgen, "mediatek,mt8183-topckgen",
 
 static int clk_mt8183_top_probe(struct platform_device *pdev)
 {
-       struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        void __iomem *base;
        struct device_node *node = pdev->dev.of_node;
 
-       base = devm_ioremap_resource(&pdev->dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
@@ -1262,9 +1261,8 @@ static int clk_mt8183_mcu_probe(struct platform_device *pdev)
        struct clk_onecell_data *clk_data;
        struct device_node *node = pdev->dev.of_node;
        void __iomem *base;
-       struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-       base = devm_ioremap_resource(&pdev->dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);