Skip to content

Commit

Permalink
fb: remove fb_save_state() and fb_restore_state operations
Browse files Browse the repository at this point in the history
Remove fb_save_state() and fb_restore_state operations from frame buffer layer.
They are used only in two drivers:
1. savagefb  - and cause bug #11248
2. uvesafb

Usage of these operations is misunderstood in both drivers so kill these
operations, fix the bug #11248 and avoid confusion in the future.

Tested on Savage 3D/MV card and the patch fixes the bug #11248.

The frame buffer layer uses these funtions during switch between graphics
and text mode of the console, but these drivers saves state before
switching of the frame buffer (in the fb_open) and after releasing it (in
the fb_release).  This defeats the purpose of these operations.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11248

Signed-off-by: Krzysztof Helt <[email protected]>
Reported-by: Jochen Hein <[email protected]>
Tested-by: Jochen Hein <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Michal Januszewski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Krzysztof-H authored and torvalds committed Nov 12, 2009
1 parent 9d0ed60 commit f5c15d0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 62 deletions.
6 changes: 0 additions & 6 deletions drivers/video/atafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ extern unsigned char fontdata_8x16[];
*
* * perform fb specific mmap *
* int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
*
* * save current hardware state *
* void (*fb_save_state)(struct fb_info *info);
*
* * restore saved state *
* void (*fb_restore_state)(struct fb_info *info);
* } ;
*/

Expand Down
5 changes: 1 addition & 4 deletions drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2311,14 +2311,11 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
ops->graphics = 1;

if (!blank) {
if (info->fbops->fb_save_state)
info->fbops->fb_save_state(info);
var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
fb_set_var(info, &var);
ops->graphics = 0;
ops->var = info->var;
} else if (info->fbops->fb_restore_state)
info->fbops->fb_restore_state(info);
}
}

if (!fbcon_is_inactive(vc, info)) {
Expand Down
18 changes: 0 additions & 18 deletions drivers/video/savage/savagefb_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,22 +1606,6 @@ static int savagefb_blank(int blank, struct fb_info *info)
return (blank == FB_BLANK_NORMAL) ? 1 : 0;
}

static void savagefb_save_state(struct fb_info *info)
{
struct savagefb_par *par = info->par;

savage_get_default_par(par, &par->save);
}

static void savagefb_restore_state(struct fb_info *info)
{
struct savagefb_par *par = info->par;

savagefb_blank(FB_BLANK_POWERDOWN, info);
savage_set_default_par(par, &par->save);
savagefb_blank(FB_BLANK_UNBLANK, info);
}

static int savagefb_open(struct fb_info *info, int user)
{
struct savagefb_par *par = info->par;
Expand Down Expand Up @@ -1667,8 +1651,6 @@ static struct fb_ops savagefb_ops = {
.fb_setcolreg = savagefb_setcolreg,
.fb_pan_display = savagefb_pan_display,
.fb_blank = savagefb_blank,
.fb_save_state = savagefb_save_state,
.fb_restore_state = savagefb_restore_state,
#if defined(CONFIG_FB_SAVAGE_ACCEL)
.fb_fillrect = savagefb_fillrect,
.fb_copyarea = savagefb_copyarea,
Expand Down
28 changes: 0 additions & 28 deletions drivers/video/uvesafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,23 +1411,6 @@ static int uvesafb_check_var(struct fb_var_screeninfo *var,
return 0;
}

static void uvesafb_save_state(struct fb_info *info)
{
struct uvesafb_par *par = info->par;

if (par->vbe_state_saved)
kfree(par->vbe_state_saved);

par->vbe_state_saved = uvesafb_vbe_state_save(par);
}

static void uvesafb_restore_state(struct fb_info *info)
{
struct uvesafb_par *par = info->par;

uvesafb_vbe_state_restore(par, par->vbe_state_saved);
}

static struct fb_ops uvesafb_ops = {
.owner = THIS_MODULE,
.fb_open = uvesafb_open,
Expand All @@ -1441,8 +1424,6 @@ static struct fb_ops uvesafb_ops = {
.fb_imageblit = cfb_imageblit,
.fb_check_var = uvesafb_check_var,
.fb_set_par = uvesafb_set_par,
.fb_save_state = uvesafb_save_state,
.fb_restore_state = uvesafb_restore_state,
};

static void __devinit uvesafb_init_info(struct fb_info *info,
Expand All @@ -1459,15 +1440,6 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
info->fix.ypanstep = par->ypan ? 1 : 0;
info->fix.ywrapstep = (par->ypan > 1) ? 1 : 0;

/*
* If we were unable to get the state buffer size, disable
* functions for saving and restoring the hardware state.
*/
if (par->vbe_state_size == 0) {
info->fbops->fb_save_state = NULL;
info->fbops->fb_restore_state = NULL;
}

/* Disable blanking if the user requested so. */
if (!blank)
info->fbops->fb_blank = NULL;
Expand Down
6 changes: 0 additions & 6 deletions include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,6 @@ struct fb_ops {
/* perform fb specific mmap */
int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);

/* save current hardware state */
void (*fb_save_state)(struct fb_info *info);

/* restore saved state */
void (*fb_restore_state)(struct fb_info *info);

/* get capability given var */
void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
struct fb_var_screeninfo *var);
Expand Down

0 comments on commit f5c15d0

Please sign in to comment.