soc: loongson: loongson2_guts: Convert to devm_platform_ioremap_resource()
authorDongliang Mu <dzm91@hust.edu.cn>
Fri, 1 Sep 2023 06:25:48 +0000 (14:25 +0800)
committerArnd Bergmann <arnd@arndb.de>
Wed, 27 Sep 2023 09:05:47 +0000 (11:05 +0200)
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/soc/loongson/loongson2_guts.c

index bace4bc..d97c77a 100644 (file)
@@ -94,7 +94,6 @@ static int loongson2_guts_probe(struct platform_device *pdev)
 {
        struct device_node *root, *np = pdev->dev.of_node;
        struct device *dev = &pdev->dev;
-       struct resource *res;
        const struct loongson2_soc_die_attr *soc_die;
        const char *machine;
        u32 svr;
@@ -106,8 +105,7 @@ static int loongson2_guts_probe(struct platform_device *pdev)
 
        guts->little_endian = of_property_read_bool(np, "little-endian");
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       guts->regs = ioremap(res->start, res->end - res->start + 1);
+       guts->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(guts->regs))
                return PTR_ERR(guts->regs);