drm/sun4i: Make use of the helper function devm_platform_ioremap_resource()
authorCai Huoqing <caihuoqing@baidu.com>
Tue, 31 Aug 2021 13:57:39 +0000 (21:57 +0800)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 1 Sep 2021 09:43:29 +0000 (11:43 +0200)
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>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210831135740.4826-1-caihuoqing@baidu.com
drivers/gpu/drm/sun4i/sun4i_backend.c
drivers/gpu/drm/sun4i/sun4i_frontend.c
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sun4i_tv.c
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_tcon_top.c

index bf8cfefa0365279047ec26cd5322cadc120a2ffa..f52ff4e6c6626b830eb87847a343e6c70bbd62f7 100644 (file)
@@ -782,7 +782,6 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
        struct sun4i_drv *drv = drm->dev_private;
        struct sun4i_backend *backend;
        const struct sun4i_backend_quirks *quirks;
-       struct resource *res;
        void __iomem *regs;
        int i, ret;
 
@@ -815,8 +814,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
        if (IS_ERR(backend->frontend))
                dev_warn(dev, "Couldn't find matching frontend, frontend features disabled\n");
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
index edb60ae0a9b75f667b67f65d7380c1208b8f977e..56ae38389db0b25b79d02aab3b941f27a4a0ac5c 100644 (file)
@@ -561,7 +561,6 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master,
        struct sun4i_frontend *frontend;
        struct drm_device *drm = data;
        struct sun4i_drv *drv = drm->dev_private;
-       struct resource *res;
        void __iomem *regs;
 
        frontend = devm_kzalloc(dev, sizeof(*frontend), GFP_KERNEL);
@@ -576,8 +575,7 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master,
        if (!frontend->data)
                return -ENODEV;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
index 2f2c9f0a10716a9767bf2f1fb6325b001fa05566..3799a745b7dd9e26a61c5291f6b6ef2a1a8b1dbc 100644 (file)
@@ -489,7 +489,6 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
        struct cec_connector_info conn_info;
        struct sun4i_drv *drv = drm->dev_private;
        struct sun4i_hdmi *hdmi;
-       struct resource *res;
        u32 reg;
        int ret;
 
@@ -504,8 +503,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
        if (!hdmi->variant)
                return -EINVAL;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       hdmi->base = devm_ioremap_resource(dev, res);
+       hdmi->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(hdmi->base)) {
                dev_err(dev, "Couldn't map the HDMI encoder registers\n");
                return PTR_ERR(hdmi->base);
index 9f06dec0fc61d826b0cce32196d06bf8bd701432..88db2d2a933681a9b4d1ab0afa282797daa154fe 100644 (file)
@@ -841,11 +841,9 @@ static int sun4i_tcon_init_regmap(struct device *dev,
                                  struct sun4i_tcon *tcon)
 {
        struct platform_device *pdev = to_platform_device(dev);
-       struct resource *res;
        void __iomem *regs;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
index cb91bc11a0c7e7fa63f1b1f950dd8421e94cc825..94883abe0dfdb2b3f7e2f00987973cb0548e4b10 100644 (file)
@@ -538,7 +538,6 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
        struct drm_device *drm = data;
        struct sun4i_drv *drv = drm->dev_private;
        struct sun4i_tv *tv;
-       struct resource *res;
        void __iomem *regs;
        int ret;
 
@@ -548,8 +547,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
        tv->drv = drv;
        dev_set_drvdata(dev, tv);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs)) {
                dev_err(dev, "Couldn't map the TV encoder registers\n");
                return PTR_ERR(regs);
index 4f5efcace68ea515c1114224c31f65c86f742f65..4371684697bda2795ae1a086e85bbb220b23112e 100644 (file)
@@ -1104,7 +1104,6 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        const char *bus_clk_name = NULL;
        struct sun6i_dsi *dsi;
-       struct resource *res;
        void __iomem *base;
        int ret;
 
@@ -1120,8 +1119,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
                                    "allwinner,sun6i-a31-mipi-dsi"))
                bus_clk_name = "bus";
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base)) {
                dev_err(dev, "Couldn't map the DSI encoder registers\n");
                return PTR_ERR(base);
index 5b42cf25cc86ab11e9863c280425d626fdeb6eb2..f5e8aeaa3cdf802675299685585a292fd9ab5c0d 100644 (file)
@@ -337,7 +337,6 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
        struct drm_device *drm = data;
        struct sun4i_drv *drv = drm->dev_private;
        struct sun8i_mixer *mixer;
-       struct resource *res;
        void __iomem *regs;
        unsigned int base;
        int plane_cnt;
@@ -390,8 +389,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
        if (!mixer->cfg)
                return -EINVAL;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
index 75d8e60c149d963b5e683a8006e8d7e98df684ad..1b9b8b48f4a707fd60879408da7c60240edbc725 100644 (file)
@@ -128,7 +128,6 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
        struct clk_hw_onecell_data *clk_data;
        struct sun8i_tcon_top *tcon_top;
        const struct sun8i_tcon_top_quirks *quirks;
-       struct resource *res;
        void __iomem *regs;
        int ret, i;
 
@@ -158,8 +157,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
                return PTR_ERR(tcon_top->bus);
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        tcon_top->regs = regs;
        if (IS_ERR(regs))
                return PTR_ERR(regs);