On Wednesday 22 July 2009, Martin Dauskardt wrote:
> The problem seems to be that ivtvfb does not "know" that it is used by the
> console (have no other idea why the /proc/fb keeps existing), therefore
> giving no error when trying to unload it.
> I was using "fbcon=map:2" .This should disable the framebuffer
> console and prevent ivtvfb from being used for console. Obviously this
> doesn't work as expected.
The problem is actually caused by fbcon trying to release something it never
had. The release fails & this prevents the framebuffer entry from being
removed. If fbcon is able to grab a single framebuffer, this error doesn't
occur.
The attached patch is different from before, as it now also covers using the
fbcon=map:X option. Essentially, it's the same problem though.
Attempting to unload a framebuffer module calls unregister_framebuffer() which
in turn gets fbcon to release it. If fbcon has no framebuffers linked to a
console, it will also unbind itself from the console driver. However, if fbcon
never did a bind, the unbind will fail and the framebuffer entry will persist.
Attempting to access the now non-existent device will result in an oops of
some type.
This patch ensures that the fbcon unbind request will succeed even if a bind
was never done. It tracks if a successful bind ever occurred & will only
attempt to unbind if needed. If there never was a bind, it simply returns with
no error.
--
Ian
--- drivers/video/console/fbcon.c.old 2009-07-23 07:46:36.000000000 +0100
+++ drivers/video/console/fbcon.c 2009-07-23 07:45:22.000000000 +0100
@@ -114,6 +114,7 @@ static int last_fb_vc = MAX_NR_CONSOLES
static int fbcon_is_default = 1;
static int fbcon_has_exited;
static int primary_device = -1;
+static int fbcon_has_console_bind = 0;
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
static int map_override;
@@ -544,6 +545,8 @@ static int fbcon_takeover(int show_logo)
con2fb_map[i] = -1;
}
info_idx = -1;
+ } else {
+ fbcon_has_console_bind = 1;
}
return err;
@@ -2923,6 +2926,10 @@ static int fbcon_unbind(void)
ret = unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
+
+ if (!ret)
+ fbcon_has_console_bind = 0;
+
return ret;
}
#else
@@ -2936,6 +2943,9 @@ static int fbcon_fb_unbind(int idx)
{
int i, new_idx = -1, ret = 0;
+ if (!fbcon_has_console_bind)
+ return 0;
+
for (i = first_fb_vc; i <= last_fb_vc; i++) {
if (con2fb_map[i] != idx &&
con2fb_map[i] != -1) {
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel