Commit f5df171f authored by Cai Huoqing's avatar Cai Huoqing Committed by Maxime Ripard

drm/sun4i: Make use of the helper function devm_platform_ioremap_resource()

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately
Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
Reviewed-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210831135740.4826-1-caihuoqing@baidu.com
parent 23019ff2
...@@ -782,7 +782,6 @@ static int sun4i_backend_bind(struct device *dev, struct device *master, ...@@ -782,7 +782,6 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
struct sun4i_drv *drv = drm->dev_private; struct sun4i_drv *drv = drm->dev_private;
struct sun4i_backend *backend; struct sun4i_backend *backend;
const struct sun4i_backend_quirks *quirks; const struct sun4i_backend_quirks *quirks;
struct resource *res;
void __iomem *regs; void __iomem *regs;
int i, ret; int i, ret;
...@@ -815,8 +814,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master, ...@@ -815,8 +814,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
if (IS_ERR(backend->frontend)) if (IS_ERR(backend->frontend))
dev_warn(dev, "Couldn't find matching frontend, frontend features disabled\n"); dev_warn(dev, "Couldn't find matching frontend, frontend features disabled\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -561,7 +561,6 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master, ...@@ -561,7 +561,6 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master,
struct sun4i_frontend *frontend; struct sun4i_frontend *frontend;
struct drm_device *drm = data; struct drm_device *drm = data;
struct sun4i_drv *drv = drm->dev_private; struct sun4i_drv *drv = drm->dev_private;
struct resource *res;
void __iomem *regs; void __iomem *regs;
frontend = devm_kzalloc(dev, sizeof(*frontend), GFP_KERNEL); frontend = devm_kzalloc(dev, sizeof(*frontend), GFP_KERNEL);
...@@ -576,8 +575,7 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master, ...@@ -576,8 +575,7 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master,
if (!frontend->data) if (!frontend->data)
return -ENODEV; return -ENODEV;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -489,7 +489,6 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, ...@@ -489,7 +489,6 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
struct cec_connector_info conn_info; struct cec_connector_info conn_info;
struct sun4i_drv *drv = drm->dev_private; struct sun4i_drv *drv = drm->dev_private;
struct sun4i_hdmi *hdmi; struct sun4i_hdmi *hdmi;
struct resource *res;
u32 reg; u32 reg;
int ret; int ret;
...@@ -504,8 +503,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, ...@@ -504,8 +503,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
if (!hdmi->variant) if (!hdmi->variant)
return -EINVAL; return -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hdmi->base = devm_platform_ioremap_resource(pdev, 0);
hdmi->base = devm_ioremap_resource(dev, res);
if (IS_ERR(hdmi->base)) { if (IS_ERR(hdmi->base)) {
dev_err(dev, "Couldn't map the HDMI encoder registers\n"); dev_err(dev, "Couldn't map the HDMI encoder registers\n");
return PTR_ERR(hdmi->base); return PTR_ERR(hdmi->base);
......
...@@ -841,11 +841,9 @@ static int sun4i_tcon_init_regmap(struct device *dev, ...@@ -841,11 +841,9 @@ static int sun4i_tcon_init_regmap(struct device *dev,
struct sun4i_tcon *tcon) struct sun4i_tcon *tcon)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct resource *res;
void __iomem *regs; void __iomem *regs;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -538,7 +538,6 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, ...@@ -538,7 +538,6 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
struct drm_device *drm = data; struct drm_device *drm = data;
struct sun4i_drv *drv = drm->dev_private; struct sun4i_drv *drv = drm->dev_private;
struct sun4i_tv *tv; struct sun4i_tv *tv;
struct resource *res;
void __iomem *regs; void __iomem *regs;
int ret; int ret;
...@@ -548,8 +547,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, ...@@ -548,8 +547,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master,
tv->drv = drv; tv->drv = drv;
dev_set_drvdata(dev, tv); dev_set_drvdata(dev, tv);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) { if (IS_ERR(regs)) {
dev_err(dev, "Couldn't map the TV encoder registers\n"); dev_err(dev, "Couldn't map the TV encoder registers\n");
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -1104,7 +1104,6 @@ static int sun6i_dsi_probe(struct platform_device *pdev) ...@@ -1104,7 +1104,6 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const char *bus_clk_name = NULL; const char *bus_clk_name = NULL;
struct sun6i_dsi *dsi; struct sun6i_dsi *dsi;
struct resource *res;
void __iomem *base; void __iomem *base;
int ret; int ret;
...@@ -1120,8 +1119,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev) ...@@ -1120,8 +1119,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
"allwinner,sun6i-a31-mipi-dsi")) "allwinner,sun6i-a31-mipi-dsi"))
bus_clk_name = "bus"; bus_clk_name = "bus";
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) { if (IS_ERR(base)) {
dev_err(dev, "Couldn't map the DSI encoder registers\n"); dev_err(dev, "Couldn't map the DSI encoder registers\n");
return PTR_ERR(base); return PTR_ERR(base);
......
...@@ -337,7 +337,6 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, ...@@ -337,7 +337,6 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
struct drm_device *drm = data; struct drm_device *drm = data;
struct sun4i_drv *drv = drm->dev_private; struct sun4i_drv *drv = drm->dev_private;
struct sun8i_mixer *mixer; struct sun8i_mixer *mixer;
struct resource *res;
void __iomem *regs; void __iomem *regs;
unsigned int base; unsigned int base;
int plane_cnt; int plane_cnt;
...@@ -390,8 +389,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, ...@@ -390,8 +389,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
if (!mixer->cfg) if (!mixer->cfg)
return -EINVAL; return -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -128,7 +128,6 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, ...@@ -128,7 +128,6 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
struct clk_hw_onecell_data *clk_data; struct clk_hw_onecell_data *clk_data;
struct sun8i_tcon_top *tcon_top; struct sun8i_tcon_top *tcon_top;
const struct sun8i_tcon_top_quirks *quirks; const struct sun8i_tcon_top_quirks *quirks;
struct resource *res;
void __iomem *regs; void __iomem *regs;
int ret, i; int ret, i;
...@@ -158,8 +157,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, ...@@ -158,8 +157,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
return PTR_ERR(tcon_top->bus); return PTR_ERR(tcon_top->bus);
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(dev, res);
tcon_top->regs = regs; tcon_top->regs = regs;
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment