|
@@ -2954,8 +2954,11 @@ static int fbcon_fb_unbind(int idx)
|
|
|
|
|
|
static int fbcon_fb_unregistered(struct fb_info *info)
|
|
static int fbcon_fb_unregistered(struct fb_info *info)
|
|
{
|
|
{
|
|
- int i, idx = info->node;
|
|
|
|
|
|
+ int i, idx;
|
|
|
|
|
|
|
|
+ if (!lock_fb_info(info))
|
|
|
|
+ return -ENODEV;
|
|
|
|
+ idx = info->node;
|
|
for (i = first_fb_vc; i <= last_fb_vc; i++) {
|
|
for (i = first_fb_vc; i <= last_fb_vc; i++) {
|
|
if (con2fb_map[i] == idx)
|
|
if (con2fb_map[i] == idx)
|
|
con2fb_map[i] = -1;
|
|
con2fb_map[i] = -1;
|
|
@@ -2979,13 +2982,14 @@ static int fbcon_fb_unregistered(struct fb_info *info)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (!num_registered_fb)
|
|
|
|
- unregister_con_driver(&fb_con);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
if (primary_device == idx)
|
|
if (primary_device == idx)
|
|
primary_device = -1;
|
|
primary_device = -1;
|
|
|
|
|
|
|
|
+ unlock_fb_info(info);
|
|
|
|
+
|
|
|
|
+ if (!num_registered_fb)
|
|
|
|
+ unregister_con_driver(&fb_con);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3021,9 +3025,13 @@ static inline void fbcon_select_primary(struct fb_info *info)
|
|
|
|
|
|
static int fbcon_fb_registered(struct fb_info *info)
|
|
static int fbcon_fb_registered(struct fb_info *info)
|
|
{
|
|
{
|
|
- int ret = 0, i, idx = info->node;
|
|
|
|
|
|
+ int ret = 0, i, idx;
|
|
|
|
|
|
|
|
+ if (!lock_fb_info(info))
|
|
|
|
+ return -ENODEV;
|
|
|
|
+ idx = info->node;
|
|
fbcon_select_primary(info);
|
|
fbcon_select_primary(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
|
|
|
|
if (info_idx == -1) {
|
|
if (info_idx == -1) {
|
|
for (i = first_fb_vc; i <= last_fb_vc; i++) {
|
|
for (i = first_fb_vc; i <= last_fb_vc; i++) {
|
|
@@ -3124,7 +3132,7 @@ static void fbcon_get_requirement(struct fb_info *info,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static int fbcon_event_notify(struct notifier_block *self,
|
|
|
|
|
|
+static int fbcon_event_notify(struct notifier_block *self,
|
|
unsigned long action, void *data)
|
|
unsigned long action, void *data)
|
|
{
|
|
{
|
|
struct fb_event *event = data;
|
|
struct fb_event *event = data;
|
|
@@ -3132,7 +3140,7 @@ static int fbcon_event_notify(struct notifier_block *self,
|
|
struct fb_videomode *mode;
|
|
struct fb_videomode *mode;
|
|
struct fb_con2fbmap *con2fb;
|
|
struct fb_con2fbmap *con2fb;
|
|
struct fb_blit_caps *caps;
|
|
struct fb_blit_caps *caps;
|
|
- int ret = 0;
|
|
|
|
|
|
+ int idx, ret = 0;
|
|
|
|
|
|
/*
|
|
/*
|
|
* ignore all events except driver registration and deregistration
|
|
* ignore all events except driver registration and deregistration
|
|
@@ -3144,23 +3152,54 @@ static int fbcon_event_notify(struct notifier_block *self,
|
|
|
|
|
|
switch(action) {
|
|
switch(action) {
|
|
case FB_EVENT_SUSPEND:
|
|
case FB_EVENT_SUSPEND:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_suspended(info);
|
|
fbcon_suspended(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_RESUME:
|
|
case FB_EVENT_RESUME:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_resumed(info);
|
|
fbcon_resumed(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_MODE_CHANGE:
|
|
case FB_EVENT_MODE_CHANGE:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_modechanged(info);
|
|
fbcon_modechanged(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_MODE_CHANGE_ALL:
|
|
case FB_EVENT_MODE_CHANGE_ALL:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_set_all_vcs(info);
|
|
fbcon_set_all_vcs(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_MODE_DELETE:
|
|
case FB_EVENT_MODE_DELETE:
|
|
mode = event->data;
|
|
mode = event->data;
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
ret = fbcon_mode_deleted(info, mode);
|
|
ret = fbcon_mode_deleted(info, mode);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_FB_UNBIND:
|
|
case FB_EVENT_FB_UNBIND:
|
|
- ret = fbcon_fb_unbind(info->node);
|
|
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
|
|
+ idx = info->node;
|
|
|
|
+ unlock_fb_info(info);
|
|
|
|
+ ret = fbcon_fb_unbind(idx);
|
|
break;
|
|
break;
|
|
case FB_EVENT_FB_REGISTERED:
|
|
case FB_EVENT_FB_REGISTERED:
|
|
ret = fbcon_fb_registered(info);
|
|
ret = fbcon_fb_registered(info);
|
|
@@ -3178,17 +3217,31 @@ static int fbcon_event_notify(struct notifier_block *self,
|
|
con2fb->framebuffer = con2fb_map[con2fb->console - 1];
|
|
con2fb->framebuffer = con2fb_map[con2fb->console - 1];
|
|
break;
|
|
break;
|
|
case FB_EVENT_BLANK:
|
|
case FB_EVENT_BLANK:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_fb_blanked(info, *(int *)event->data);
|
|
fbcon_fb_blanked(info, *(int *)event->data);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_NEW_MODELIST:
|
|
case FB_EVENT_NEW_MODELIST:
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_new_modelist(info);
|
|
fbcon_new_modelist(info);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
case FB_EVENT_GET_REQ:
|
|
case FB_EVENT_GET_REQ:
|
|
caps = event->data;
|
|
caps = event->data;
|
|
|
|
+ if (!lock_fb_info(info)) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto done;
|
|
|
|
+ }
|
|
fbcon_get_requirement(info, caps);
|
|
fbcon_get_requirement(info, caps);
|
|
|
|
+ unlock_fb_info(info);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
done:
|
|
done:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|