Commit ed8414ab authored by Cai Huoqing's avatar Cai Huoqing Committed by Tomi Valkeinen

drm/omap: Make use of the helper function devm_platform_ioremap_resourcexxx()

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately

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 avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210831135707.4676-1-caihuoqing@baidu.com
parent b92f7ea5
...@@ -4725,7 +4725,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) ...@@ -4725,7 +4725,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
struct dispc_device *dispc; struct dispc_device *dispc;
u32 rev; u32 rev;
int r = 0; int r = 0;
struct resource *dispc_mem;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
dispc = kzalloc(sizeof(*dispc), GFP_KERNEL); dispc = kzalloc(sizeof(*dispc), GFP_KERNEL);
...@@ -4750,8 +4749,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) ...@@ -4750,8 +4749,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
if (r) if (r)
goto err_free; goto err_free;
dispc_mem = platform_get_resource(dispc->pdev, IORESOURCE_MEM, 0); dispc->base = devm_platform_ioremap_resource(pdev, 0);
dispc->base = devm_ioremap_resource(&pdev->dev, dispc_mem);
if (IS_ERR(dispc->base)) { if (IS_ERR(dispc->base)) {
r = PTR_ERR(dispc->base); r = PTR_ERR(dispc->base);
goto err_free; goto err_free;
......
...@@ -4884,7 +4884,6 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -4884,7 +4884,6 @@ static int dsi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct dsi_data *dsi; struct dsi_data *dsi;
struct resource *dsi_mem; struct resource *dsi_mem;
struct resource *res;
unsigned int i; unsigned int i;
int r; int r;
...@@ -4921,13 +4920,11 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -4921,13 +4920,11 @@ static int dsi_probe(struct platform_device *pdev)
if (IS_ERR(dsi->proto_base)) if (IS_ERR(dsi->proto_base))
return PTR_ERR(dsi->proto_base); return PTR_ERR(dsi->proto_base);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); dsi->phy_base = devm_platform_ioremap_resource_byname(pdev, "phy");
dsi->phy_base = devm_ioremap_resource(dev, res);
if (IS_ERR(dsi->phy_base)) if (IS_ERR(dsi->phy_base))
return PTR_ERR(dsi->phy_base); return PTR_ERR(dsi->phy_base);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll"); dsi->pll_base = devm_platform_ioremap_resource_byname(pdev, "pll");
dsi->pll_base = devm_ioremap_resource(dev, res);
if (IS_ERR(dsi->pll_base)) if (IS_ERR(dsi->pll_base))
return PTR_ERR(dsi->pll_base); return PTR_ERR(dsi->pll_base);
......
...@@ -1424,7 +1424,6 @@ static int dss_probe(struct platform_device *pdev) ...@@ -1424,7 +1424,6 @@ static int dss_probe(struct platform_device *pdev)
const struct soc_device_attribute *soc; const struct soc_device_attribute *soc;
struct dss_component_match_data cmatch; struct dss_component_match_data cmatch;
struct component_match *match = NULL; struct component_match *match = NULL;
struct resource *dss_mem;
struct dss_device *dss; struct dss_device *dss;
int r; int r;
...@@ -1452,8 +1451,7 @@ static int dss_probe(struct platform_device *pdev) ...@@ -1452,8 +1451,7 @@ static int dss_probe(struct platform_device *pdev)
dss->feat = of_match_device(dss_of_match, &pdev->dev)->data; dss->feat = of_match_device(dss_of_match, &pdev->dev)->data;
/* Map I/O registers, get and setup clocks. */ /* Map I/O registers, get and setup clocks. */
dss_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); dss->base = devm_platform_ioremap_resource(pdev, 0);
dss->base = devm_ioremap_resource(&pdev->dev, dss_mem);
if (IS_ERR(dss->base)) { if (IS_ERR(dss->base)) {
r = PTR_ERR(dss->base); r = PTR_ERR(dss->base);
goto err_free_dss; goto err_free_dss;
......
...@@ -870,7 +870,6 @@ static const struct soc_device_attribute hdmi4_soc_devices[] = { ...@@ -870,7 +870,6 @@ static const struct soc_device_attribute hdmi4_soc_devices[] = {
int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core) int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{ {
const struct hdmi4_features *features; const struct hdmi4_features *features;
struct resource *res;
const struct soc_device_attribute *soc; const struct soc_device_attribute *soc;
soc = soc_device_match(hdmi4_soc_devices); soc = soc_device_match(hdmi4_soc_devices);
...@@ -881,8 +880,7 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core) ...@@ -881,8 +880,7 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
core->cts_swmode = features->cts_swmode; core->cts_swmode = features->cts_swmode;
core->audio_use_mclk = features->audio_use_mclk; core->audio_use_mclk = features->audio_use_mclk;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core"); core->base = devm_platform_ioremap_resource_byname(pdev, "core");
core->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(core->base)) if (IS_ERR(core->base))
return PTR_ERR(core->base); return PTR_ERR(core->base);
......
...@@ -872,10 +872,7 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, ...@@ -872,10 +872,7 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core) int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{ {
struct resource *res; core->base = devm_platform_ioremap_resource_byname(pdev, "core");
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
core->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(core->base)) if (IS_ERR(core->base))
return PTR_ERR(core->base); return PTR_ERR(core->base);
......
...@@ -182,15 +182,12 @@ static const struct hdmi_phy_features omap54xx_phy_feats = { ...@@ -182,15 +182,12 @@ static const struct hdmi_phy_features omap54xx_phy_feats = {
int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy, int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,
unsigned int version) unsigned int version)
{ {
struct resource *res;
if (version == 4) if (version == 4)
phy->features = &omap44xx_phy_feats; phy->features = &omap44xx_phy_feats;
else else
phy->features = &omap54xx_phy_feats; phy->features = &omap54xx_phy_feats;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); phy->base = devm_platform_ioremap_resource_byname(pdev, "phy");
phy->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(phy->base)) if (IS_ERR(phy->base))
return PTR_ERR(phy->base); return PTR_ERR(phy->base);
......
...@@ -162,13 +162,11 @@ int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev, ...@@ -162,13 +162,11 @@ int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
struct hdmi_pll_data *pll, struct hdmi_wp_data *wp) struct hdmi_pll_data *pll, struct hdmi_wp_data *wp)
{ {
int r; int r;
struct resource *res;
pll->pdev = pdev; pll->pdev = pdev;
pll->wp = wp; pll->wp = wp;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll"); pll->base = devm_platform_ioremap_resource_byname(pdev, "pll");
pll->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pll->base)) if (IS_ERR(pll->base))
return PTR_ERR(pll->base); return PTR_ERR(pll->base);
......
...@@ -806,7 +806,6 @@ static const struct soc_device_attribute venc_soc_devices[] = { ...@@ -806,7 +806,6 @@ static const struct soc_device_attribute venc_soc_devices[] = {
static int venc_probe(struct platform_device *pdev) static int venc_probe(struct platform_device *pdev)
{ {
struct venc_device *venc; struct venc_device *venc;
struct resource *venc_mem;
int r; int r;
venc = kzalloc(sizeof(*venc), GFP_KERNEL); venc = kzalloc(sizeof(*venc), GFP_KERNEL);
...@@ -823,8 +822,7 @@ static int venc_probe(struct platform_device *pdev) ...@@ -823,8 +822,7 @@ static int venc_probe(struct platform_device *pdev)
venc->config = &venc_config_pal_trm; venc->config = &venc_config_pal_trm;
venc_mem = platform_get_resource(venc->pdev, IORESOURCE_MEM, 0); venc->base = devm_platform_ioremap_resource(pdev, 0);
venc->base = devm_ioremap_resource(&pdev->dev, venc_mem);
if (IS_ERR(venc->base)) { if (IS_ERR(venc->base)) {
r = PTR_ERR(venc->base); r = PTR_ERR(venc->base);
goto err_free; goto err_free;
......
...@@ -137,7 +137,6 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss, ...@@ -137,7 +137,6 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss,
const char * const clkctrl_name[] = { "pll1_clkctrl", "pll2_clkctrl" }; const char * const clkctrl_name[] = { "pll1_clkctrl", "pll2_clkctrl" };
const char * const clkin_name[] = { "video1_clk", "video2_clk" }; const char * const clkin_name[] = { "video1_clk", "video2_clk" };
struct resource *res;
struct dss_video_pll *vpll; struct dss_video_pll *vpll;
void __iomem *pll_base, *clkctrl_base; void __iomem *pll_base, *clkctrl_base;
struct clk *clk; struct clk *clk;
...@@ -146,16 +145,13 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss, ...@@ -146,16 +145,13 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss,
/* PLL CONTROL */ /* PLL CONTROL */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, reg_name[id]); pll_base = devm_platform_ioremap_resource_byname(pdev, reg_name[id]);
pll_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pll_base)) if (IS_ERR(pll_base))
return ERR_CAST(pll_base); return ERR_CAST(pll_base);
/* CLOCK CONTROL */ /* CLOCK CONTROL */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, clkctrl_base = devm_platform_ioremap_resource_byname(pdev, clkctrl_name[id]);
clkctrl_name[id]);
clkctrl_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(clkctrl_base)) if (IS_ERR(clkctrl_base))
return ERR_CAST(clkctrl_base); return ERR_CAST(clkctrl_base);
......
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