Skip to content

Commit 171a072

Browse files
committed
drm/vc4: gem: Add a managed action to cleanup the job queue
The job queue needs to be cleaned up using vc4_gem_destroy, but it's not used consistently (vc4_drv's bind calls it in its error path, but doesn't in unbind), and we can make that automatic through a managed action. Let's remove the requirement to call vc4_gem_destroy. Fixes: d5b1a78 ("drm/vc4: Add support for drawing 3D frames.") Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20201029190104.2181730-3-maxime@cerno.tech
1 parent e46e533 commit 171a072

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,13 @@ static int vc4_drm_bind(struct device *dev)
285285
if (ret)
286286
goto dev_put;
287287

288-
vc4_gem_init(drm);
288+
ret = vc4_gem_init(drm);
289+
if (ret)
290+
goto dev_put;
289291

290292
ret = component_bind_all(dev, drm);
291293
if (ret)
292-
goto gem_destroy;
294+
goto dev_put;
293295

294296
ret = vc4_plane_create_additional_planes(drm);
295297
if (ret)
@@ -314,8 +316,6 @@ static int vc4_drm_bind(struct device *dev)
314316

315317
unbind_all:
316318
component_unbind_all(dev, drm);
317-
gem_destroy:
318-
vc4_gem_destroy(drm);
319319
dev_put:
320320
drm_dev_put(drm);
321321
return ret;

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,7 @@ extern struct platform_driver vc4_dsi_driver;
874874
extern const struct dma_fence_ops vc4_fence_ops;
875875

876876
/* vc4_gem.c */
877-
void vc4_gem_init(struct drm_device *dev);
878-
void vc4_gem_destroy(struct drm_device *dev);
877+
int vc4_gem_init(struct drm_device *dev);
879878
int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
880879
struct drm_file *file_priv);
881880
int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,

drivers/gpu/drm/vc4/vc4_gem.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,8 +1263,8 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
12631263
return ret;
12641264
}
12651265

1266-
void
1267-
vc4_gem_init(struct drm_device *dev)
1266+
static void vc4_gem_destroy(struct drm_device *dev, void *unused);
1267+
int vc4_gem_init(struct drm_device *dev)
12681268
{
12691269
struct vc4_dev *vc4 = to_vc4_dev(dev);
12701270

@@ -1285,10 +1285,11 @@ vc4_gem_init(struct drm_device *dev)
12851285

12861286
INIT_LIST_HEAD(&vc4->purgeable.list);
12871287
mutex_init(&vc4->purgeable.lock);
1288+
1289+
return drmm_add_action_or_reset(dev, vc4_gem_destroy, NULL);
12881290
}
12891291

1290-
void
1291-
vc4_gem_destroy(struct drm_device *dev)
1292+
static void vc4_gem_destroy(struct drm_device *dev, void *unused)
12921293
{
12931294
struct vc4_dev *vc4 = to_vc4_dev(dev);
12941295

0 commit comments

Comments
 (0)