drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()
Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code. As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare(). Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data. Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance. Fixes: 643231b2 ("drm/fbdev-generic: Minimize hotplug error handling") Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Javier Martinez Canillas <javierm@redhat.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: David Airlie <airlied@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org Signed-off-by:Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by:
Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by:
Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230216140620.17699-1-tzimmermann@suse.de
Showing
- drivers/gpu/drm/armada/armada_fbdev.c 3 additions, 0 deletionsdrivers/gpu/drm/armada/armada_fbdev.c
- drivers/gpu/drm/drm_fb_helper.c 0 additions, 2 deletionsdrivers/gpu/drm/drm_fb_helper.c
- drivers/gpu/drm/drm_fbdev_generic.c 2 additions, 0 deletionsdrivers/gpu/drm/drm_fbdev_generic.c
- drivers/gpu/drm/exynos/exynos_drm_fbdev.c 2 additions, 1 deletiondrivers/gpu/drm/exynos/exynos_drm_fbdev.c
- drivers/gpu/drm/gma500/framebuffer.c 2 additions, 0 deletionsdrivers/gpu/drm/gma500/framebuffer.c
- drivers/gpu/drm/i915/display/intel_fbdev.c 1 addition, 0 deletionsdrivers/gpu/drm/i915/display/intel_fbdev.c
- drivers/gpu/drm/msm/msm_fbdev.c 2 additions, 0 deletionsdrivers/gpu/drm/msm/msm_fbdev.c
- drivers/gpu/drm/omapdrm/omap_fbdev.c 2 additions, 0 deletionsdrivers/gpu/drm/omapdrm/omap_fbdev.c
- drivers/gpu/drm/radeon/radeon_fb.c 2 additions, 0 deletionsdrivers/gpu/drm/radeon/radeon_fb.c
- drivers/gpu/drm/tegra/fb.c 1 addition, 0 deletionsdrivers/gpu/drm/tegra/fb.c
Loading
Please register or sign in to comment