mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 15:20:41 +00:00
drm/fbdev-generic: Minimize client unregistering
For uninitialized framebuffers, only release the DRM client and free the fbdev memory. Do not attempt to clean up the framebuffer. DRM fbdev clients have a two-step initialization: first create the DRM client; then create the framebuffer device on the first successful hotplug event. In cases where the client never creates the framebuffer, only the client state needs to be released. We can detect which case it is, full or client-only cleanup, by looking at the presence of fb_helper's info field. v3: * fix typo in commit message (Javier) * release client before unpreparing fbdev v2: * remove test for (fbi != NULL) in drm_fbdev_cleanup() (Sam) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230125200415.14123-9-tzimmermann@suse.de
This commit is contained in:
parent
643231b283
commit
032116bbe1
1 changed files with 10 additions and 10 deletions
|
@ -51,12 +51,10 @@ static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper)
|
|||
if (!fb_helper->dev)
|
||||
return;
|
||||
|
||||
if (fbi) {
|
||||
if (fbi->fbdefio)
|
||||
fb_deferred_io_cleanup(fbi);
|
||||
if (drm_fbdev_use_shadow_fb(fb_helper))
|
||||
shadow = fbi->screen_buffer;
|
||||
}
|
||||
if (fbi->fbdefio)
|
||||
fb_deferred_io_cleanup(fbi);
|
||||
if (drm_fbdev_use_shadow_fb(fb_helper))
|
||||
shadow = fbi->screen_buffer;
|
||||
|
||||
drm_fb_helper_fini(fb_helper);
|
||||
|
||||
|
@ -362,11 +360,13 @@ static void drm_fbdev_client_unregister(struct drm_client_dev *client)
|
|||
{
|
||||
struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
|
||||
|
||||
if (fb_helper->info)
|
||||
/* drm_fbdev_fb_destroy() takes care of cleanup */
|
||||
if (fb_helper->info) {
|
||||
drm_fb_helper_unregister_info(fb_helper);
|
||||
else
|
||||
drm_fbdev_release(fb_helper);
|
||||
} else {
|
||||
drm_client_release(&fb_helper->client);
|
||||
drm_fb_helper_unprepare(fb_helper);
|
||||
kfree(fb_helper);
|
||||
}
|
||||
}
|
||||
|
||||
static int drm_fbdev_client_restore(struct drm_client_dev *client)
|
||||
|
|
Loading…
Reference in a new issue