Commit 323e9a18 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/mdp5: use devres-managed allocation for pipe data

Use devm_kzalloc to create pipe data structure. This allows us
to remove corresponding kfree and drop mdp5_pipe_destroy() function.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/546171/
Link: https://lore.kernel.org/r/20230708010407.3871346-6-dmitry.baryshkov@linaro.org
parent 1ad175c2
...@@ -209,10 +209,6 @@ static void mdp5_kms_destroy(struct msm_kms *kms) ...@@ -209,10 +209,6 @@ static void mdp5_kms_destroy(struct msm_kms *kms)
{ {
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
struct msm_gem_address_space *aspace = kms->aspace; struct msm_gem_address_space *aspace = kms->aspace;
int i;
for (i = 0; i < mdp5_kms->num_hwpipes; i++)
mdp5_pipe_destroy(mdp5_kms->hwpipes[i]);
if (aspace) { if (aspace) {
aspace->mmu->funcs->detach(aspace->mmu); aspace->mmu->funcs->detach(aspace->mmu);
...@@ -645,7 +641,7 @@ static int construct_pipes(struct mdp5_kms *mdp5_kms, int cnt, ...@@ -645,7 +641,7 @@ static int construct_pipes(struct mdp5_kms *mdp5_kms, int cnt,
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
struct mdp5_hw_pipe *hwpipe; struct mdp5_hw_pipe *hwpipe;
hwpipe = mdp5_pipe_init(pipes[i], offsets[i], caps); hwpipe = mdp5_pipe_init(dev, pipes[i], offsets[i], caps);
if (IS_ERR(hwpipe)) { if (IS_ERR(hwpipe)) {
ret = PTR_ERR(hwpipe); ret = PTR_ERR(hwpipe);
DRM_DEV_ERROR(dev->dev, "failed to construct pipe for %s (%d)\n", DRM_DEV_ERROR(dev->dev, "failed to construct pipe for %s (%d)\n",
......
...@@ -151,17 +151,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe) ...@@ -151,17 +151,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe)
return 0; return 0;
} }
void mdp5_pipe_destroy(struct mdp5_hw_pipe *hwpipe) struct mdp5_hw_pipe *mdp5_pipe_init(struct drm_device *dev,
{ enum mdp5_pipe pipe,
kfree(hwpipe);
}
struct mdp5_hw_pipe *mdp5_pipe_init(enum mdp5_pipe pipe,
uint32_t reg_offset, uint32_t caps) uint32_t reg_offset, uint32_t caps)
{ {
struct mdp5_hw_pipe *hwpipe; struct mdp5_hw_pipe *hwpipe;
hwpipe = kzalloc(sizeof(*hwpipe), GFP_KERNEL); hwpipe = devm_kzalloc(dev->dev, sizeof(*hwpipe), GFP_KERNEL);
if (!hwpipe) if (!hwpipe)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -39,8 +39,8 @@ int mdp5_pipe_assign(struct drm_atomic_state *s, struct drm_plane *plane, ...@@ -39,8 +39,8 @@ int mdp5_pipe_assign(struct drm_atomic_state *s, struct drm_plane *plane,
struct mdp5_hw_pipe **r_hwpipe); struct mdp5_hw_pipe **r_hwpipe);
int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe); int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe);
struct mdp5_hw_pipe *mdp5_pipe_init(enum mdp5_pipe pipe, struct mdp5_hw_pipe *mdp5_pipe_init(struct drm_device *dev,
enum mdp5_pipe pipe,
uint32_t reg_offset, uint32_t caps); uint32_t reg_offset, uint32_t caps);
void mdp5_pipe_destroy(struct mdp5_hw_pipe *hwpipe);
#endif /* __MDP5_PIPE_H__ */ #endif /* __MDP5_PIPE_H__ */
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