[PATCH v3 6/7] drm/imx: use drmm_universal_plane_alloc()
Philipp Zabel
p.zabel at pengutronix.de
Fri Sep 11 13:57:23 UTC 2020
This allows to drop the custom drm_plane_cleanup action.
Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
---
New in v3, example conversion of drm_universal_plane_init() user.
---
drivers/gpu/drm/imx/ipuv3-plane.c | 34 ++++++++-----------------------
1 file changed, 9 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 38b959aa3564..075508051b5f 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -815,13 +815,6 @@ int ipu_planes_assign_pre(struct drm_device *dev,
}
EXPORT_SYMBOL_GPL(ipu_planes_assign_pre);
-static void ipu_plane_cleanup(struct drm_device *dev, void *data)
-{
- struct ipu_plane *ipu_plane = data;
-
- drm_plane_cleanup(&ipu_plane->base);
-}
-
struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
int dma, int dp, unsigned int possible_crtcs,
enum drm_plane_type type)
@@ -834,10 +827,15 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n",
dma, dp, possible_crtcs);
- ipu_plane = drmm_kzalloc(dev, sizeof(*ipu_plane), GFP_KERNEL);
- if (!ipu_plane) {
- DRM_ERROR("failed to allocate plane\n");
- return ERR_PTR(-ENOMEM);
+ ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base,
+ possible_crtcs, &ipu_plane_funcs,
+ ipu_plane_formats,
+ ARRAY_SIZE(ipu_plane_formats),
+ modifiers, type, NULL);
+ if (IS_ERR(ipu_plane)) {
+ DRM_ERROR("failed to allocate and initialize %s plane\n",
+ zpos ? "overlay" : "primary");
+ return ipu_plane;
}
ipu_plane->ipu = ipu;
@@ -847,20 +845,6 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
if (ipu_prg_present(ipu))
modifiers = pre_format_modifiers;
- ret = drm_universal_plane_init(dev, &ipu_plane->base, possible_crtcs,
- &ipu_plane_funcs, ipu_plane_formats,
- ARRAY_SIZE(ipu_plane_formats),
- modifiers, type, NULL);
- if (ret) {
- DRM_ERROR("failed to initialize %s plane\n",
- zpos ? "overlay" : "primary");
- return ERR_PTR(ret);
- }
-
- ret = drmm_add_action_or_reset(dev, ipu_plane_cleanup, ipu_plane);
- if (ret)
- return ERR_PTR(ret);
-
drm_plane_helper_add(&ipu_plane->base, &ipu_plane_helper_funcs);
if (dp == IPU_DP_FLOW_SYNC_BG || dp == IPU_DP_FLOW_SYNC_FG)
--
2.20.1
More information about the dri-devel
mailing list