a9a3998b87b644e2875ab21ad8cda9e8c5d8ca60
[openwrt/staging/linusw.git] /
1 From 4899d3181465e16d548af03b7825c4b06e0f0e44 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Thu, 28 Apr 2022 16:11:34 +0100
4 Subject: [PATCH] Revert "fbdev: Hot-unplug firmware fb devices on
5 forced removal"
6
7 This reverts commit c894ac44786cfed383a6c6b20c1bfb12eb96018a.
8 ---
9 drivers/video/fbdev/core/fbmem.c | 29 +++--------------------------
10 include/linux/fb.h | 1 -
11 2 files changed, 3 insertions(+), 27 deletions(-)
12
13 --- a/drivers/video/fbdev/core/fbmem.c
14 +++ b/drivers/video/fbdev/core/fbmem.c
15 @@ -26,7 +26,6 @@
16 #include <linux/init.h>
17 #include <linux/linux_logo.h>
18 #include <linux/proc_fs.h>
19 -#include <linux/platform_device.h>
20 #include <linux/seq_file.h>
21 #include <linux/console.h>
22 #include <linux/kmod.h>
23 @@ -1608,36 +1607,18 @@ static void do_remove_conflicting_frameb
24 /* check all firmware fbs and kick off if the base addr overlaps */
25 for_each_registered_fb(i) {
26 struct apertures_struct *gen_aper;
27 - struct device *device;
28
29 if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
30 continue;
31
32 gen_aper = registered_fb[i]->apertures;
33 - device = registered_fb[i]->device;
34 if (fb_do_apertures_overlap(gen_aper, a) ||
35 (primary && gen_aper && gen_aper->count &&
36 gen_aper->ranges[0].base == VGA_FB_PHYS)) {
37
38 printk(KERN_INFO "fb%d: switching to %s from %s\n",
39 i, name, registered_fb[i]->fix.id);
40 -
41 - /*
42 - * If we kick-out a firmware driver, we also want to remove
43 - * the underlying platform device, such as simple-framebuffer,
44 - * VESA, EFI, etc. A native driver will then be able to
45 - * allocate the memory range.
46 - *
47 - * If it's not a platform device, at least print a warning. A
48 - * fix would add code to remove the device from the system.
49 - */
50 - if (dev_is_platform(device)) {
51 - registered_fb[i]->forced_out = true;
52 - platform_device_unregister(to_platform_device(device));
53 - } else {
54 - pr_warn("fb%d: cannot remove device\n", i);
55 - do_unregister_framebuffer(registered_fb[i]);
56 - }
57 + do_unregister_framebuffer(registered_fb[i]);
58 }
59 }
60 }
61 @@ -1975,13 +1956,9 @@ EXPORT_SYMBOL(register_framebuffer);
62 void
63 unregister_framebuffer(struct fb_info *fb_info)
64 {
65 - bool forced_out = fb_info->forced_out;
66 -
67 - if (!forced_out)
68 - mutex_lock(&registration_lock);
69 + mutex_lock(&registration_lock);
70 do_unregister_framebuffer(fb_info);
71 - if (!forced_out)
72 - mutex_unlock(&registration_lock);
73 + mutex_unlock(&registration_lock);
74 }
75 EXPORT_SYMBOL(unregister_framebuffer);
76
77 --- a/include/linux/fb.h
78 +++ b/include/linux/fb.h
79 @@ -502,7 +502,6 @@ struct fb_info {
80 } *apertures;
81
82 bool skip_vt_switch; /* no VT switch on suspend/resume required */
83 - bool forced_out; /* set when being removed by another driver */
84 };
85
86 static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {