* [PATCH] Close race with fbcon notifer
@ 2004-02-10 4:23 Benjamin Herrenschmidt
0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2004-02-10 4:23 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Fbdev development list
diff -urN fbdev-2.5/drivers/video/console/fbcon.c linuxppc-2.5-benh/drivers/video/console/fbcon.c
--- fbdev-2.5/drivers/video/console/fbcon.c 2004-02-09 14:48:31.000000000 +1100
+++ linuxppc-2.5-benh/drivers/video/console/fbcon.c 2004-02-10 15:21:29.754526880 +1100
@@ -602,7 +602,6 @@
/* on which frame buffer will we open this console? */
info = registered_fb[(int) con2fb_map[unit]];
-
if (info->var.accel_flags)
fb_display[unit].scrollmode = SCROLL_YNOMOVE;
else
@@ -2255,16 +2254,24 @@
static void fbcon_resumed(struct fb_info *info)
{
- struct vc_data *vc = vc_cons[info->currcon].d;
+ struct vc_data *vc;
+
+ if (info->currcon < 0)
+ return;
+ vc = vc_cons[info->currcon].d;
update_screen(vc->vc_num);
}
static void fbcon_mode_changed(struct fb_info *info)
{
- struct vc_data *vc = vc_cons[info->currcon].d;
+ struct vc_data *vc;
int rows, cols;
+ if (info->currcon < 0)
+ return;
+ vc = vc_cons[info->currcon].d;
+
/* This isn't perfect yet. If we change one console, we
* don't change them all and we switch back to the wrong
* mode on next console switch. We need to either keep a
@@ -2339,6 +2346,7 @@
.notifier_call = fbcon_event_notify,
};
+static int fbcon_event_notifier_registered;
int __init fb_console_init(void)
{
@@ -2349,14 +2357,24 @@
take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
info = registered_fb[num_registered_fb-1];
- fb_register_client(&fbcon_event_notifer);
+ acquire_console_semaphore();
+ if (!fbcon_event_notifier_registered) {
+ fb_register_client(&fbcon_event_notifer);
+ fbcon_event_notifier_registered = 1;
+ }
+ release_console_semaphore();
return 0;
}
void __exit fb_console_exit(void)
{
- fb_unregister_client(&fbcon_event_notifer);
+ acquire_console_semaphore();
+ if (fbcon_event_notifier_registered) {
+ fb_unregister_client(&fbcon_event_notifer);
+ fbcon_event_notifier_registered = 0;
+ }
+ release_console_semaphore();
give_up_console(&fb_con);
}
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-02-10 4:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-10 4:23 [PATCH] Close race with fbcon notifer Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).