Commit 1e897dcc authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: use devres-managed allocation for MDP TOP

Use devm_kzalloc to create MDP TOP structure. This allows us to remove
corresponding kfree and drop dpu_hw_mdp_destroy() function.
Reviewed-by: default avatarJessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/570047/
Link: https://lore.kernel.org/r/20231201211845.1026967-6-dmitry.baryshkov@linaro.org
parent bdfa47d9
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/ */
#include <drm/drm_managed.h>
#include "dpu_hwio.h" #include "dpu_hwio.h"
#include "dpu_hw_catalog.h" #include "dpu_hw_catalog.h"
#include "dpu_hw_top.h" #include "dpu_hw_top.h"
...@@ -247,7 +249,8 @@ static void _setup_mdp_ops(struct dpu_hw_mdp_ops *ops, ...@@ -247,7 +249,8 @@ static void _setup_mdp_ops(struct dpu_hw_mdp_ops *ops,
ops->intf_audio_select = dpu_hw_intf_audio_select; ops->intf_audio_select = dpu_hw_intf_audio_select;
} }
struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg, struct dpu_hw_mdp *dpu_hw_mdptop_init(struct drm_device *dev,
const struct dpu_mdp_cfg *cfg,
void __iomem *addr, void __iomem *addr,
const struct dpu_mdss_cfg *m) const struct dpu_mdss_cfg *m)
{ {
...@@ -256,7 +259,7 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg, ...@@ -256,7 +259,7 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg,
if (!addr) if (!addr)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
mdp = kzalloc(sizeof(*mdp), GFP_KERNEL); mdp = drmm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL);
if (!mdp) if (!mdp)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -271,9 +274,3 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg, ...@@ -271,9 +274,3 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg,
return mdp; return mdp;
} }
void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp)
{
kfree(mdp);
}
...@@ -145,11 +145,13 @@ struct dpu_hw_mdp { ...@@ -145,11 +145,13 @@ struct dpu_hw_mdp {
/** /**
* dpu_hw_mdptop_init - initializes the top driver for the passed config * dpu_hw_mdptop_init - initializes the top driver for the passed config
* @dev: Corresponding device for devres management
* @cfg: MDP TOP configuration from catalog * @cfg: MDP TOP configuration from catalog
* @addr: Mapped register io address of MDP * @addr: Mapped register io address of MDP
* @m: Pointer to mdss catalog data * @m: Pointer to mdss catalog data
*/ */
struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg, struct dpu_hw_mdp *dpu_hw_mdptop_init(struct drm_device *dev,
const struct dpu_mdp_cfg *cfg,
void __iomem *addr, void __iomem *addr,
const struct dpu_mdss_cfg *m); const struct dpu_mdss_cfg *m);
......
...@@ -810,8 +810,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) ...@@ -810,8 +810,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
dpu_kms->catalog = NULL; dpu_kms->catalog = NULL;
if (dpu_kms->hw_mdp)
dpu_hw_mdp_destroy(dpu_kms->hw_mdp);
dpu_kms->hw_mdp = NULL; dpu_kms->hw_mdp = NULL;
} }
...@@ -1090,7 +1088,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms) ...@@ -1090,7 +1088,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
dpu_kms->rm_init = true; dpu_kms->rm_init = true;
dpu_kms->hw_mdp = dpu_hw_mdptop_init(dpu_kms->catalog->mdp, dpu_kms->hw_mdp = dpu_hw_mdptop_init(dev,
dpu_kms->catalog->mdp,
dpu_kms->mmio, dpu_kms->mmio,
dpu_kms->catalog); dpu_kms->catalog);
if (IS_ERR(dpu_kms->hw_mdp)) { if (IS_ERR(dpu_kms->hw_mdp)) {
......
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