i2c: pxa: Use devm_platform_get_and_ioremap_resource()
authorYangtao Li <frank.li@vivo.com>
Mon, 10 Jul 2023 06:33:49 +0000 (14:33 +0800)
committerWolfram Sang <wsa@kernel.org>
Mon, 14 Aug 2023 16:10:10 +0000 (18:10 +0200)
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.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-pxa.c

index 2eae12c..29be05a 100644 (file)
@@ -1362,7 +1362,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
        struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev);
        enum pxa_i2c_types i2c_type;
        struct pxa_i2c *i2c;
-       struct resource *res = NULL;
+       struct resource *res;
        int ret, irq;
 
        i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL);
@@ -1379,8 +1379,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
        i2c->adap.dev.of_node = dev->dev.of_node;
 #endif
 
-       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-       i2c->reg_base = devm_ioremap_resource(&dev->dev, res);
+       i2c->reg_base = devm_platform_get_and_ioremap_resource(dev, 0, &res);
        if (IS_ERR(i2c->reg_base))
                return PTR_ERR(i2c->reg_base);