Commit f215d600 authored by Qilong Zhang's avatar Qilong Zhang Committed by Sam Ravnborg

omapfb: use devm_platform_ioremap_resource_byname

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.
Signed-off-by: default avatarQilong Zhang <zhangqilong3@huawei.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
[fixed warning - unused variable]
[fixed checkpatch warning - fixed indent]
Link: https://patchwork.freedesktop.org/patch/msgid/20200916111353.105914-1-zhangqilong3@huawei.com
parent 3da1781e
...@@ -875,15 +875,7 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp) ...@@ -875,15 +875,7 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp)
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)
{ {
struct resource *res; core->base = devm_platform_ioremap_resource_byname(pdev, "core");
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
if (!res) {
DSSERR("can't get CORE mem resource\n");
return -EINVAL;
}
core->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(core->base)) { if (IS_ERR(core->base)) {
DSSERR("can't ioremap CORE\n"); DSSERR("can't ioremap CORE\n");
return PTR_ERR(core->base); return PTR_ERR(core->base);
......
...@@ -887,15 +887,7 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, ...@@ -887,15 +887,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");
if (!res) {
DSSERR("can't get CORE IORESOURCE_MEM HDMI\n");
return -EINVAL;
}
core->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(core->base)) { if (IS_ERR(core->base)) {
DSSERR("can't ioremap HDMI core\n"); DSSERR("can't ioremap HDMI core\n");
return PTR_ERR(core->base); return PTR_ERR(core->base);
......
...@@ -207,19 +207,11 @@ static const struct hdmi_phy_features *hdmi_phy_get_features(void) ...@@ -207,19 +207,11 @@ static const struct hdmi_phy_features *hdmi_phy_get_features(void)
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)
{ {
struct resource *res;
phy_feat = hdmi_phy_get_features(); phy_feat = hdmi_phy_get_features();
if (!phy_feat) if (!phy_feat)
return -ENODEV; return -ENODEV;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); phy->base = devm_platform_ioremap_resource_byname(pdev, "phy");
if (!res) {
DSSERR("can't get PHY mem resource\n");
return -EINVAL;
}
phy->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(phy->base)) { if (IS_ERR(phy->base)) {
DSSERR("can't ioremap TX PHY\n"); DSSERR("can't ioremap TX PHY\n");
return PTR_ERR(phy->base); return PTR_ERR(phy->base);
......
...@@ -100,7 +100,6 @@ static int hdmi_pll_enable(struct dss_pll *dsspll) ...@@ -100,7 +100,6 @@ static int hdmi_pll_enable(struct dss_pll *dsspll)
{ {
struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll); struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll);
struct hdmi_wp_data *wp = pll->wp; struct hdmi_wp_data *wp = pll->wp;
u16 r = 0;
dss_ctrl_pll_enable(DSS_PLL_HDMI, true); dss_ctrl_pll_enable(DSS_PLL_HDMI, true);
...@@ -216,17 +215,10 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll, ...@@ -216,17 +215,10 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
struct hdmi_wp_data *wp) struct hdmi_wp_data *wp)
{ {
int r; int r;
struct resource *res;
pll->wp = wp; pll->wp = wp;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll"); pll->base = devm_platform_ioremap_resource_byname(pdev, "pll");
if (!res) {
DSSERR("can't get PLL mem resource\n");
return -EINVAL;
}
pll->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pll->base)) { if (IS_ERR(pll->base)) {
DSSERR("can't ioremap PLLCTRL\n"); DSSERR("can't ioremap PLLCTRL\n");
return PTR_ERR(pll->base); return PTR_ERR(pll->base);
......
...@@ -129,7 +129,6 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, ...@@ -129,7 +129,6 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id,
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;
...@@ -138,14 +137,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, ...@@ -138,14 +137,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id,
/* 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]);
if (!res) {
dev_err(&pdev->dev,
"missing platform resource data for pll%d\n", id);
return ERR_PTR(-ENODEV);
}
pll_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pll_base)) { if (IS_ERR(pll_base)) {
dev_err(&pdev->dev, "failed to ioremap pll%d reg_name\n", id); dev_err(&pdev->dev, "failed to ioremap pll%d reg_name\n", id);
return ERR_CAST(pll_base); return ERR_CAST(pll_base);
...@@ -153,15 +145,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, ...@@ -153,15 +145,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id,
/* 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]);
if (!res) {
dev_err(&pdev->dev,
"missing platform resource data for pll%d\n", id);
return ERR_PTR(-ENODEV);
}
clkctrl_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(clkctrl_base)) { if (IS_ERR(clkctrl_base)) {
dev_err(&pdev->dev, "failed to ioremap pll%d clkctrl\n", id); dev_err(&pdev->dev, "failed to ioremap pll%d clkctrl\n", id);
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