]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
fbdev: unify unlink_framebuffer paths
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 28 May 2019 09:02:50 +0000 (11:02 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 12 Jun 2019 18:28:57 +0000 (20:28 +0200)
For some reasons the pm_vt_switch_unregister call was missing from the
direct unregister_framebuffer path. Fix this.

v2: fbinfo->dev is used to decided whether unlink_framebuffer has been
called already. I botched that in v1. Make this all clearer by
inlining __unlink_framebuffer.

v3: Fix typoe in subject (Maarten).

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Peter Rosin <peda@axentia.se>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190528090304.9388-20-daniel.vetter@ffwll.ch
drivers/video/fbdev/core/fbmem.c

index f3bcad30d3bae908ccc3c95328fb99bb313a48d2..bee45e9405b8e10426c3bfbd19c658566c27bf5a 100644 (file)
@@ -1722,15 +1722,30 @@ static void unbind_console(struct fb_info *fb_info)
        console_unlock();
 }
 
-static void __unlink_framebuffer(struct fb_info *fb_info);
-
-static void do_unregister_framebuffer(struct fb_info *fb_info)
+void unlink_framebuffer(struct fb_info *fb_info)
 {
-       unbind_console(fb_info);
+       int i;
+
+       i = fb_info->node;
+       if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
+               return;
+
+       if (!fb_info->dev)
+               return;
+
+       device_destroy(fb_class, MKDEV(FB_MAJOR, i));
 
        pm_vt_switch_unregister(fb_info->dev);
 
-       __unlink_framebuffer(fb_info);
+       unbind_console(fb_info);
+
+       fb_info->dev = NULL;
+}
+EXPORT_SYMBOL(unlink_framebuffer);
+
+static void do_unregister_framebuffer(struct fb_info *fb_info)
+{
+       unlink_framebuffer(fb_info);
        if (fb_info->pixmap.addr &&
            (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
                kfree(fb_info->pixmap.addr);
@@ -1753,28 +1768,6 @@ static void do_unregister_framebuffer(struct fb_info *fb_info)
        put_fb_info(fb_info);
 }
 
-static void __unlink_framebuffer(struct fb_info *fb_info)
-{
-       int i;
-
-       i = fb_info->node;
-       if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
-               return;
-
-       if (fb_info->dev) {
-               device_destroy(fb_class, MKDEV(FB_MAJOR, i));
-               fb_info->dev = NULL;
-       }
-}
-
-void unlink_framebuffer(struct fb_info *fb_info)
-{
-       __unlink_framebuffer(fb_info);
-
-       unbind_console(fb_info);
-}
-EXPORT_SYMBOL(unlink_framebuffer);
-
 /**
  * remove_conflicting_framebuffers - remove firmware-configured framebuffers
  * @a: memory range, users of which are to be removed