Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139265
b: refs/heads/master
c: 66c1ca0
h: refs/heads/master
i:
  139263: 78d0ae8
v: v3
  • Loading branch information
Andrea Righi authored and Linus Torvalds committed Apr 1, 2009
1 parent df3d2fc commit 0490546
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8636a9240cc93efa6b36f4cfe6253e0574f832c6
refs/heads/master: 66c1ca019078220dc1bf968f2bb18421100ef147
3 changes: 3 additions & 0 deletions trunk/drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ static int fb_notifier_callback(struct notifier_block *self,
return 0;

bd = container_of(self, struct backlight_device, fb_notif);
if (!lock_fb_info(evdata->info))
return -ENODEV;
mutex_lock(&bd->ops_lock);
if (bd->ops)
if (!bd->ops->check_fb ||
Expand All @@ -47,6 +49,7 @@ static int fb_notifier_callback(struct notifier_block *self,
backlight_update_status(bd);
}
mutex_unlock(&bd->ops_lock);
unlock_fb_info(evdata->info);
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/video/backlight/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!ld->ops)
return 0;

if (!lock_fb_info(evdata->info))
return -ENODEV;
mutex_lock(&ld->ops_lock);
if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) {
if (event == FB_EVENT_BLANK) {
Expand All @@ -51,6 +53,7 @@ static int fb_notifier_callback(struct notifier_block *self,
}
}
mutex_unlock(&ld->ops_lock);
unlock_fb_info(evdata->info);
return 0;
}

Expand Down
73 changes: 63 additions & 10 deletions trunk/drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2954,8 +2954,11 @@ static int fbcon_fb_unbind(int idx)

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++) {
if (con2fb_map[i] == idx)
con2fb_map[i] = -1;
Expand All @@ -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)
primary_device = -1;

unlock_fb_info(info);

if (!num_registered_fb)
unregister_con_driver(&fb_con);

return 0;
}

Expand Down Expand Up @@ -3021,9 +3025,13 @@ static inline void fbcon_select_primary(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);
unlock_fb_info(info);

if (info_idx == -1) {
for (i = first_fb_vc; i <= last_fb_vc; i++) {
Expand Down Expand Up @@ -3124,15 +3132,15 @@ 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)
{
struct fb_event *event = data;
struct fb_info *info = event->info;
struct fb_videomode *mode;
struct fb_con2fbmap *con2fb;
struct fb_blit_caps *caps;
int ret = 0;
int idx, ret = 0;

/*
* ignore all events except driver registration and deregistration
Expand All @@ -3144,23 +3152,54 @@ static int fbcon_event_notify(struct notifier_block *self,

switch(action) {
case FB_EVENT_SUSPEND:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_suspended(info);
unlock_fb_info(info);
break;
case FB_EVENT_RESUME:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_resumed(info);
unlock_fb_info(info);
break;
case FB_EVENT_MODE_CHANGE:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_modechanged(info);
unlock_fb_info(info);
break;
case FB_EVENT_MODE_CHANGE_ALL:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_set_all_vcs(info);
unlock_fb_info(info);
break;
case FB_EVENT_MODE_DELETE:
mode = event->data;
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
ret = fbcon_mode_deleted(info, mode);
unlock_fb_info(info);
break;
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;
case FB_EVENT_FB_REGISTERED:
ret = fbcon_fb_registered(info);
Expand All @@ -3178,17 +3217,31 @@ static int fbcon_event_notify(struct notifier_block *self,
con2fb->framebuffer = con2fb_map[con2fb->console - 1];
break;
case FB_EVENT_BLANK:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_fb_blanked(info, *(int *)event->data);
unlock_fb_info(info);
break;
case FB_EVENT_NEW_MODELIST:
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_new_modelist(info);
unlock_fb_info(info);
break;
case FB_EVENT_GET_REQ:
caps = event->data;
if (!lock_fb_info(info)) {
ret = -ENODEV;
goto done;
}
fbcon_get_requirement(info, caps);
unlock_fb_info(info);
break;
}

done:
return ret;
}
Expand Down
11 changes: 1 addition & 10 deletions trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,13 +1086,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
return -EINVAL;
con2fb.framebuffer = -1;
event.data = &con2fb;

if (!lock_fb_info(info))
return -ENODEV;
event.info = info;
fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
unlock_fb_info(info);

ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0;
break;
case FBIOPUT_CON2FBMAP:
Expand All @@ -1109,12 +1104,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
break;
}
event.data = &con2fb;
if (!lock_fb_info(info))
return -ENODEV;
event.info = info;
ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP,
&event);
unlock_fb_info(info);
ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event);
break;
case FBIOBLANK:
if (!lock_fb_info(info))
Expand Down

0 comments on commit 0490546

Please sign in to comment.