Commit 94c60aad authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbcon/fbdev: Remove fbcon-specific fields from struct fb_info

The following fields in struct fb_info is specific only to fbcon:
- struct timer_ cursor_timer
- int currcon

Remove them from struct fb_info and place them in fbcon_par so they become
invisible from the drivers.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1b126bfe
......@@ -1326,7 +1326,6 @@ static int __init acornfb_probe(struct device *dev)
}
}
fb_info.currcon = -1;
fb_info.screen_base = (char *)SCREEN_BASE;
fb_info.fix.smem_start = SCREEN_START;
current_par.using_vram = 0;
......
......@@ -1749,7 +1749,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
{
struct fb_info *info = rinfo->info;
info->currcon = -1;
info->par = rinfo;
info->pseudo_palette = rinfo->pseudo_palette;
info->flags = FBINFO_DEFAULT
......
......@@ -361,7 +361,6 @@ static void bw2_init_one(struct sbus_dev *sdev)
if (!all->info.screen_base)
all->info.screen_base = (char *)
sbus_ioremap(resp, 0, all->par.fbsize, "bw2 ram");
all->info.currcon = -1;
all->info.par = &all->par;
bw2_blank(0, &all->info);
......
......@@ -552,7 +552,6 @@ static void cg14_init_one(struct sbus_dev *sdev, int node, int parent_node)
all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
all->info.fbops = &cg14_ops;
all->info.currcon = -1;
all->info.par = &all->par;
__cg14_reset(&all->par);
......
......@@ -408,7 +408,6 @@ static void cg3_init_one(struct sbus_dev *sdev)
all->info.screen_base = (char *)
sbus_ioremap(&sdev->resource[0], CG3_RAM_OFFSET,
all->par.fbsize, "cg3 ram");
all->info.currcon = -1;
all->info.par = &all->par;
cg3_blank(0, &all->info);
......
......@@ -723,7 +723,6 @@ static void cg6_init_one(struct sbus_dev *sdev)
all->info.screen_base = (char *)
sbus_ioremap(&sdev->resource[0], CG6_RAM_OFFSET,
all->par.fbsize, "cgsix ram");
all->info.currcon = -1;
all->info.par = &all->par;
all->info.var.accel_flags = FB_ACCELF_TEXT;
......
......@@ -2246,7 +2246,6 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo)
struct fb_info *info = cinfo->info;
struct fb_var_screeninfo *var = &info->var;
info->currcon = -1;
info->par = cinfo;
info->pseudo_palette = cinfo->pseudo_palette;
info->flags = FBINFO_DEFAULT
......
......@@ -249,8 +249,8 @@ static void fb_flashcursor(void *private)
int c;
int mode;
if (info->currcon != -1)
vc = vc_cons[info->currcon].d;
if (ops->currcon != -1)
vc = vc_cons[ops->currcon].d;
if (info->state != FBINFO_STATE_RUNNING ||
!vc || !CON_IS_VISIBLE(vc) ||
......@@ -284,9 +284,10 @@ static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp)
static void cursor_timer_handler(unsigned long dev_addr)
{
struct fb_info *info = (struct fb_info *) dev_addr;
struct fbcon_ops *ops = info->fbcon_par;
schedule_work(&info->queue);
mod_timer(&info->cursor_timer, jiffies + HZ/5);
mod_timer(&ops->cursor_timer, jiffies + HZ/5);
}
int __init fb_console_setup(char *this_opt)
......@@ -502,6 +503,7 @@ static int set_con2fb_map(int unit, int newidx, int user)
int oldidx = con2fb_map[unit];
struct fb_info *info = registered_fb[newidx];
struct fb_info *oldinfo = NULL;
struct fbcon_ops *ops;
int found;
if (oldidx == newidx)
......@@ -524,8 +526,10 @@ static int set_con2fb_map(int unit, int newidx, int user)
con2fb_map[unit] = newidx;
if (!found) {
struct fbcon_ops *ops = NULL;
int err = 0;
ops = NULL;
if (!try_module_get(info->fbops->owner)) {
err = -ENODEV;
}
......@@ -560,7 +564,8 @@ static int set_con2fb_map(int unit, int newidx, int user)
* fbcon should release it.
*/
if (oldinfo && !search_fb_in_map(oldidx)) {
struct fbcon_ops *ops = (struct fbcon_ops *) oldinfo->fbcon_par;
ops = oldinfo->fbcon_par;
if (oldinfo->fbops->fb_release &&
oldinfo->fbops->fb_release(oldinfo, 0)) {
......@@ -574,28 +579,33 @@ static int set_con2fb_map(int unit, int newidx, int user)
}
if (oldinfo->queue.func == fb_flashcursor)
del_timer_sync(&oldinfo->cursor_timer);
del_timer_sync(&ops->cursor_timer);
kfree(ops->cursor_state.mask);
kfree(ops->cursor_data);
kfree(oldinfo->fbcon_par);
oldinfo->fbcon_par = NULL;
module_put(oldinfo->fbops->owner);
}
if (!found) {
if (!info->queue.func || info->queue.func == fb_flashcursor) {
ops = info->fbcon_par;
if (!info->queue.func)
INIT_WORK(&info->queue, fb_flashcursor, info);
init_timer(&info->cursor_timer);
info->cursor_timer.function = cursor_timer_handler;
info->cursor_timer.expires = jiffies + HZ / 5;
info->cursor_timer.data = (unsigned long ) info;
add_timer(&info->cursor_timer);
init_timer(&ops->cursor_timer);
ops->cursor_timer.function = cursor_timer_handler;
ops->cursor_timer.expires = jiffies + HZ / 5;
ops->cursor_timer.data = (unsigned long ) info;
add_timer(&ops->cursor_timer);
}
}
info->currcon = fg_console;
ops = info->fbcon_par;
ops->currcon = fg_console;
con2fb_map_boot[unit] = newidx;
if (info->fbops->fb_set_par)
......@@ -690,7 +700,6 @@ static const char *fbcon_startup(void)
info = registered_fb[info_idx];
if (!info)
return NULL;
info->currcon = -1;
owner = info->fbops->owner;
if (!try_module_get(owner))
......@@ -707,6 +716,7 @@ static const char *fbcon_startup(void)
}
memset(ops, 0, sizeof(struct fbcon_ops));
ops->currcon = -1;
info->fbcon_par = ops;
set_blitting_type(vc, info, NULL);
......@@ -821,11 +831,11 @@ static const char *fbcon_startup(void)
if (!info->queue.func) {
INIT_WORK(&info->queue, fb_flashcursor, info);
init_timer(&info->cursor_timer);
info->cursor_timer.function = cursor_timer_handler;
info->cursor_timer.expires = jiffies + HZ / 5;
info->cursor_timer.data = (unsigned long ) info;
add_timer(&info->cursor_timer);
init_timer(&ops->cursor_timer);
ops->cursor_timer.function = cursor_timer_handler;
ops->cursor_timer.expires = jiffies + HZ / 5;
ops->cursor_timer.data = (unsigned long ) info;
add_timer(&ops->cursor_timer);
}
return display_desc;
}
......@@ -1074,7 +1084,7 @@ static int scrollback_current = 0;
int update_var(int con, struct fb_info *info)
{
if (con == info->currcon)
if (con == ((struct fbcon_ops *)info->fbcon_par)->currcon)
return fb_pan_display(info, &info->var);
return 0;
}
......@@ -1877,7 +1887,7 @@ static int fbcon_switch(struct vc_data *vc)
logo_shown = FBCON_LOGO_CANSHOW;
}
prev_console = info->currcon;
prev_console = ((struct fbcon_ops *)info->fbcon_par)->currcon;
/*
* FIXME: If we have multiple fbdev's loaded, we need to
......@@ -1888,10 +1898,12 @@ static int fbcon_switch(struct vc_data *vc)
* info->currcon = vc->vc_num;
*/
for (i = 0; i < FB_MAX; i++) {
if (registered_fb[i] != NULL)
registered_fb[i]->currcon = vc->vc_num;
}
if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) {
struct fbcon_ops *ops = registered_fb[i]->fbcon_par;
ops->currcon = vc->vc_num;
}
}
memset(&var, 0, sizeof(struct fb_var_screeninfo));
display_to_var(&var, p);
var.activate = FB_ACTIVATE_NOW;
......@@ -1960,7 +1972,7 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
{
unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par;
struct fbcon_ops *ops = info->fbcon_par;
struct display *p = &fb_display[vc->vc_num];
int retval = 0;
......@@ -2517,10 +2529,11 @@ static int fbcon_set_origin(struct vc_data *vc)
static void fbcon_suspended(struct fb_info *info)
{
struct vc_data *vc = NULL;
struct fbcon_ops *ops = info->fbcon_par;
if (info->currcon < 0)
if (!ops || ops->currcon < 0)
return;
vc = vc_cons[info->currcon].d;
vc = vc_cons[ops->currcon].d;
/* Clear cursor, restore saved data */
fbcon_cursor(vc, CM_ERASE);
......@@ -2529,21 +2542,28 @@ static void fbcon_suspended(struct fb_info *info)
static void fbcon_resumed(struct fb_info *info)
{
struct vc_data *vc;
struct fbcon_ops *ops = info->fbcon_par;
if (info->currcon < 0)
if (!ops || ops->currcon < 0)
return;
vc = vc_cons[info->currcon].d;
vc = vc_cons[ops->currcon].d;
update_screen(vc->vc_num);
}
static void fbcon_modechanged(struct fb_info *info)
{
struct vc_data *vc = vc_cons[info->currcon].d;
struct fbcon_ops *ops = info->fbcon_par;
struct vc_data *vc;
struct display *p;
int rows, cols;
if (info->currcon < 0 || vt_cons[info->currcon]->vc_mode !=
if (!ops)
return;
vc = vc_cons[ops->currcon].d;
if (ops->currcon < 0 || vt_cons[ops->currcon]->vc_mode !=
KD_TEXT)
return;
p = &fb_display[vc->vc_num];
......
......@@ -61,7 +61,9 @@ struct fbcon_ops {
void (*cursor)(struct vc_data *vc, struct fb_info *info,
struct display *p, int mode, int fg, int bg);
struct timer_list cursor_timer; /* Cursor timer */
struct fb_cursor cursor_state;
int currcon; /* Current VC. */
int cursor_flash;
char *cursor_data;
};
......
......@@ -969,7 +969,6 @@ static void ffb_init_one(int node, int parent)
FBINFO_HWACCEL_IMAGEBLIT);
all->info.fbops = &ffb_ops;
all->info.screen_base = (char *) all->par.physbase + FFB_DFB24_POFF;
all->info.currcon = -1;
all->info.par = &all->par;
all->info.pseudo_palette = all->pseudo_palette;
......
......@@ -1140,7 +1140,6 @@ int __init gbefb_init(void)
for (i = 0; i < (gbe_mem_size >> TILE_SHIFT); i++)
gbe_tiles.cpu[i] = (gbe_mem_phys >> TILE_SHIFT) + i;
fb_info.currcon = -1;
fb_info.fbops = &gbefb_ops;
fb_info.pseudo_palette = pseudo_palette;
fb_info.flags = FBINFO_DEFAULT;
......
......@@ -1108,7 +1108,6 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
DBG_MSG("intelfb_set_fbinfo\n");
//info->currcon = -1;
info->flags = FBINFO_FLAG_DEFAULT;
info->fbops = &intel_fb_ops;
info->pseudo_palette = dinfo->pseudo_palette;
......
......@@ -590,7 +590,6 @@ static void leo_init_one(struct sbus_dev *sdev)
all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
all->info.fbops = &leo_ops;
all->info.currcon = -1;
all->info.par = &all->par;
leo_init_wids(&all->info);
......
......@@ -1712,7 +1712,6 @@ static int initMatrox2(WPMINFO struct board* b){
}
ACCESS_FBINFO(devflags.ydstorg) = 0;
ACCESS_FBINFO(fbcon.currcon) = -1;
ACCESS_FBINFO(video.base) = video_base_phys;
ACCESS_FBINFO(video.len_usable) = ACCESS_FBINFO(video.len);
if (ACCESS_FBINFO(video.len_usable) > b->base->maxdisplayable)
......@@ -1877,7 +1876,12 @@ static int initMatrox2(WPMINFO struct board* b){
}
printk("fb%d: %s frame buffer device\n",
ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id));
if (ACCESS_FBINFO(fbcon.currcon) < 0) {
/*
* Tony: If this driver is to be mapped to the console, then
* fbcon will automatically do a set_par for us. The code below
* may not be needed.
*/
/* there is no console on this fb... but we have to initialize hardware
* until someone tells me what is proper thing to do */
printk(KERN_INFO "fb%d: initializing hardware\n",
......@@ -1886,7 +1890,7 @@ static int initMatrox2(WPMINFO struct board* b){
* already before, so register_framebuffer works correctly. */
vesafb_defined.activate |= FB_ACTIVATE_FORCE;
fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined);
}
return 0;
failVideoIO:;
matroxfb_g450_shutdown(PMINFO2);
......
......@@ -605,7 +605,6 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
m2info->fbcon.flags = FBINFO_FLAG_DEFAULT;
m2info->fbcon.flags |= FBINFO_HWACCEL_XPAN |
FBINFO_HWACCEL_YPAN;
m2info->fbcon.currcon = -1;
m2info->fbcon.pseudo_palette = m2info->cmap;
fb_alloc_cmap(&m2info->fbcon.cmap, 256, 1);
......@@ -634,9 +633,7 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
if (register_framebuffer(&m2info->fbcon)) {
return -ENXIO;
}
if (m2info->fbcon.currcon < 0) {
fb_set_var(&m2info->fbcon, &matroxfb_dh_defined);
}
down_write(&ACCESS_FBINFO(crtc2.lock));
oldcrtc2 = ACCESS_FBINFO(crtc2.info);
ACCESS_FBINFO(crtc2.info) = m2info;
......
......@@ -307,7 +307,6 @@ static void p9100_init_one(struct sbus_dev *sdev)
all->info.screen_base = (char *)
sbus_ioremap(&sdev->resource[2], 0,
all->par.fbsize, "p9100 ram");
all->info.currcon = -1;
all->info.par = &all->par;
p9100_blank(0, &all->info);
......
......@@ -1043,7 +1043,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
fbi->fb.fbops = &pxafb_ops;
fbi->fb.flags = FBINFO_DEFAULT;
fbi->fb.node = -1;
fbi->fb.currcon = -1;
addr = fbi;
addr = addr + sizeof(struct pxafb_info);
......
......@@ -2247,7 +2247,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
info = &rinfo->info;
info->currcon = -1;
info->par = rinfo;
info->pseudo_palette = rinfo->pseudo_palette;
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
......
......@@ -1673,7 +1673,6 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
fbi->fb.fbops = &sa1100fb_ops;
fbi->fb.flags = FBINFO_DEFAULT;
fbi->fb.monspecs = monspecs;
fbi->fb.currcon = -1;
fbi->fb.pseudo_palette = (fbi + 1);
fbi->rgb[RGB_8] = &rgb_8;
......
......@@ -1813,8 +1813,11 @@ sisfb_set_par(struct fb_info *info)
return err;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
sisfb_get_fix(&info->fix, info->currcon, info);
#else
sisfb_get_fix(&info->fix, -1, info);
#endif
return 0;
}
......
......@@ -1471,7 +1471,6 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
info->flags = FBINFO_DEFAULT;
info->fbops = &sstfb_ops;
info->currcon = -1;
info->pseudo_palette = &all->pseudo_palette;
fix->type = FB_TYPE_PACKED_PIXELS;
......
......@@ -1335,7 +1335,6 @@ stifb_init_fb(struct sti_struct *sti, int force_bpp)
info->fbops = &stifb_ops;
info->screen_base = (void*) REGION_BASE(fb,1);
info->flags = FBINFO_DEFAULT;
info->currcon = -1;
info->pseudo_palette = &fb->pseudo_palette;
/* This has to been done !!! */
......
......@@ -422,7 +422,6 @@ static void tcx_init_one(struct sbus_dev *sdev)
all->info.screen_base = (char *)
sbus_ioremap(&sdev->resource[0], 0,
all->par.fbsize, "tcx ram");
all->info.currcon = -1;
all->info.par = &all->par;
/* Initialize brooktree DAC. */
......
......@@ -1430,7 +1430,6 @@ tgafb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT;
all->info.fbops = &tgafb_ops;
all->info.screen_base = (char *) all->par.tga_fb_base;
all->info.currcon = -1;
all->info.par = &all->par;
all->info.pseudo_palette = all->pseudo_palette;
......
......@@ -859,7 +859,6 @@ static int vga16fb_blank(int blank, struct fb_info *info)
par->vesa_blanked = 0;
}
if (par->palette_blanked) {
//do_install_cmap(info->currcon, info);
par->palette_blanked = 0;
}
break;
......
......@@ -685,7 +685,6 @@ struct fb_info {
struct fb_fix_screeninfo fix; /* Current fix */
struct fb_monspecs monspecs; /* Current Monitor specs */
struct work_struct queue; /* Framebuffer event queue */
struct timer_list cursor_timer; /* Cursor timer */
struct fb_pixmap pixmap; /* Image hardware mapper */
struct fb_pixmap sprite; /* Cursor hardware mapper */
struct fb_cmap cmap; /* Current cmap */
......@@ -697,7 +696,6 @@ struct fb_info {
#endif
char __iomem *screen_base; /* Virtual address */
unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */
int currcon; /* Current VC. */
void *pseudo_palette; /* Fake palette of 16 colors */
#define FBINFO_STATE_RUNNING 0
#define FBINFO_STATE_SUSPENDED 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment