950-0881-Revert-fbdev-Hot-unplug-firmware-fb-devices-on-force.patch 2.8 KB

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