Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60895
b: refs/heads/master
c: cfafca8
h: refs/heads/master
i:
  60893: 15172f9
  60891: 4aae8ef
  60887: d5ef974
  60879: 72a93c8
  60863: d562a4f
v: v3
  • Loading branch information
Jesse Barnes authored and Linus Torvalds committed Jul 17, 2007
1 parent 905dece commit 32e7402
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 5 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: afd1db1632c3f8f95cbc2786bfa122cead79db58
refs/heads/master: cfafca8067c6defbaeb28cb898b7b3f8abdfe20d
42 changes: 42 additions & 0 deletions trunk/drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3003,6 +3003,45 @@ static int fbcon_mode_deleted(struct fb_info *info,
return found;
}

#ifdef CONFIG_VT_HW_CONSOLE_BINDING
static int fbcon_unbind(void)
{
int ret;

ret = unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
return ret;
}
#else
static inline int fbcon_unbind(void)
{
return -EINVAL;
}
#endif /* CONFIG_VT_HW_CONSOLE_BINDING */

static int fbcon_fb_unbind(int idx)
{
int i, new_idx = -1, ret = 0;

for (i = first_fb_vc; i <= last_fb_vc; i++) {
if (con2fb_map[i] != idx &&
con2fb_map[i] != -1) {
new_idx = i;
break;
}
}

if (new_idx != -1) {
for (i = first_fb_vc; i <= last_fb_vc; i++) {
if (con2fb_map[i] == idx)
set_con2fb_map(i, new_idx, 0);
}
} else
ret = fbcon_unbind();

return ret;
}

static int fbcon_fb_unregistered(struct fb_info *info)
{
int i, idx = info->node;
Expand Down Expand Up @@ -3210,6 +3249,9 @@ static int fbcon_event_notify(struct notifier_block *self,
mode = event->data;
ret = fbcon_mode_deleted(info, mode);
break;
case FB_EVENT_FB_UNBIND:
ret = fbcon_fb_unbind(info->node);
break;
case FB_EVENT_FB_REGISTERED:
ret = fbcon_fb_registered(info);
break;
Expand Down
26 changes: 22 additions & 4 deletions trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,17 +1334,34 @@ register_framebuffer(struct fb_info *fb_info)
*
* Returns negative errno on error, or zero for success.
*
* This function will also notify the framebuffer console
* to release the driver.
*
* This is meant to be called within a driver's module_exit()
* function. If this is called outside module_exit(), ensure
* that the driver implements fb_open() and fb_release() to
* check that no processes are using the device.
*/

int
unregister_framebuffer(struct fb_info *fb_info)
{
struct fb_event event;
int i;
int i, ret = 0;

i = fb_info->node;
if (!registered_fb[i])
return -EINVAL;
if (!registered_fb[i]) {
ret = -EINVAL;
goto done;
}

event.info = fb_info;
ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);

if (ret) {
ret = -EINVAL;
goto done;
}

if (fb_info->pixmap.addr &&
(fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
Expand All @@ -1356,7 +1373,8 @@ unregister_framebuffer(struct fb_info *fb_info)
device_destroy(fb_class, MKDEV(FB_MAJOR, i));
event.info = fb_info;
fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
return 0;
done:
return ret;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ struct fb_cursor_user {
#define FB_EVENT_CONBLANK 0x0C
/* Get drawing requirements */
#define FB_EVENT_GET_REQ 0x0D
/* Unbind from the console if possible */
#define FB_EVENT_FB_UNBIND 0x0E

struct fb_event {
struct fb_info *info;
Expand Down

0 comments on commit 32e7402

Please sign in to comment.