mailbox: sun6i: Make use of the helper function devm_platform_ioremap_resource()
authorCai Huoqing <caihuoqing@baidu.com>
Tue, 7 Sep 2021 07:42:00 +0000 (15:42 +0800)
committerJassi Brar <jaswinder.singh@linaro.org>
Sat, 16 Oct 2021 19:39:49 +0000 (14:39 -0500)
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/sun6i-msgbox.c

index ccecf2e5941ddb70d0036ab42aebc3cda823d76b..7f8d931042d384a46a6484d34390aefd56f28b8d 100644 (file)
@@ -197,7 +197,6 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct mbox_chan *chans;
        struct reset_control *reset;
-       struct resource *res;
        struct sun6i_msgbox *mbox;
        int i, ret;
 
@@ -246,13 +245,7 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
                goto err_disable_unprepare;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               ret = -ENODEV;
-               goto err_disable_unprepare;
-       }
-
-       mbox->regs = devm_ioremap_resource(&pdev->dev, res);
+       mbox->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(mbox->regs)) {
                ret = PTR_ERR(mbox->regs);
                dev_err(dev, "Failed to map MMIO resource: %d\n", ret);