Skip to content

Commit

Permalink
Revert "fbdev: Hot-unplug firmware fb devices on forced removal"
Browse files Browse the repository at this point in the history
This reverts commit c894ac4.
  • Loading branch information
popcornmix committed May 4, 2022
1 parent fe84a90 commit 1da5300
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
29 changes: 3 additions & 26 deletions drivers/video/fbdev/core/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <linux/init.h>
#include <linux/linux_logo.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
#include <linux/seq_file.h>
#include <linux/console.h>
#include <linux/kmod.h>
Expand Down Expand Up @@ -1595,36 +1594,18 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
/* check all firmware fbs and kick off if the base addr overlaps */
for_each_registered_fb(i) {
struct apertures_struct *gen_aper;
struct device *device;

if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
continue;

gen_aper = registered_fb[i]->apertures;
device = registered_fb[i]->device;
if (fb_do_apertures_overlap(gen_aper, a) ||
(primary && gen_aper && gen_aper->count &&
gen_aper->ranges[0].base == VGA_FB_PHYS)) {

printk(KERN_INFO "fb%d: switching to %s from %s\n",
i, name, registered_fb[i]->fix.id);

/*
* If we kick-out a firmware driver, we also want to remove
* the underlying platform device, such as simple-framebuffer,
* VESA, EFI, etc. A native driver will then be able to
* allocate the memory range.
*
* If it's not a platform device, at least print a warning. A
* fix would add code to remove the device from the system.
*/
if (dev_is_platform(device)) {
registered_fb[i]->forced_out = true;
platform_device_unregister(to_platform_device(device));
} else {
pr_warn("fb%d: cannot remove device\n", i);
do_unregister_framebuffer(registered_fb[i]);
}
do_unregister_framebuffer(registered_fb[i]);
}
}
}
Expand Down Expand Up @@ -1954,13 +1935,9 @@ EXPORT_SYMBOL(register_framebuffer);
void
unregister_framebuffer(struct fb_info *fb_info)
{
bool forced_out = fb_info->forced_out;

if (!forced_out)
mutex_lock(&registration_lock);
mutex_lock(&registration_lock);
do_unregister_framebuffer(fb_info);
if (!forced_out)
mutex_unlock(&registration_lock);
mutex_unlock(&registration_lock);
}
EXPORT_SYMBOL(unregister_framebuffer);

Expand Down
1 change: 0 additions & 1 deletion include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ struct fb_info {
} *apertures;

bool skip_vt_switch; /* no VT switch on suspend/resume required */
bool forced_out; /* set when being removed by another driver */
};

static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
Expand Down

0 comments on commit 1da5300

Please sign in to comment.