1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/6.1/target/linux/bcm27xx/patches-6.1/950-0603-rpisense-fb-Flush-any-deferred-updates-on-release.patch
Ycarus (Yannick Chabanois) 3743692973 Fix RPI5 support
2023-11-17 17:31:36 +01:00

42 lines
1.4 KiB
Diff

From 60ba1d16e234cd67fc88489c9ac2da41925647c9 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 24 Mar 2023 13:15:36 +0000
Subject: [PATCH] rpisense-fb: Flush any deferred updates on release
Since [1], writing to the Sense HAT framebuffer and immediately closing
the file descriptor is likely to have no effect. This is because the
framebuffer deferred IO framework is now careful to cancel pending
updates.
To retain the old behaviour, add an fb_release method that flushes the
updates instead.
See: https://github.com/raspberrypi/linux/issues/5398
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
[1] 3efc61d95259 ("fbdev: Fix invalid page access after closing deferred I/O devices")
---
drivers/video/fbdev/rpisense-fb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/video/fbdev/rpisense-fb.c
+++ b/drivers/video/fbdev/rpisense-fb.c
@@ -183,8 +183,18 @@ static int rpisense_fb_ioctl(struct fb_i
return 0;
}
+static int rpisense_fb_release(struct fb_info *info, int user)
+{
+ /* Flush any pending updates */
+ cancel_delayed_work(&info->deferred_work);
+ schedule_delayed_work(&info->deferred_work, 0);
+
+ return 0;
+}
+
static struct fb_ops rpisense_fb_ops = {
.owner = THIS_MODULE,
+ .fb_release = rpisense_fb_release,
.fb_read = fb_sys_read,
.fb_write = rpisense_fb_write,
.fb_fillrect = rpisense_fb_fillrect,