X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fvideo%2Fneofb.c;h=395ccedde9a63b5718afdefb34d3f3c4f7235db8;hb=3689a0ec60bc8f56cc372c1dfa0d89dab48f7c9c;hp=deaf820cb38f798542271ef2ebf65277f5efc087;hpb=678f2b7df24c34f90fee264fa3a8069bca9c99ad;p=linux-2.6-omap-h63xx.git diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index deaf820cb38..395ccedde9a 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c @@ -66,7 +66,6 @@ #include #ifdef CONFIG_TOSHIBA #include -extern int tosh_smm(SMMRegisters *regs); #endif #include @@ -557,14 +556,16 @@ static int neofb_open(struct fb_info *info, int user) { struct neofb_par *par = info->par; - int cnt = atomic_read(&par->ref_count); - if (!cnt) { + mutex_lock(&par->open_lock); + if (!par->ref_count) { memset(&par->state, 0, sizeof(struct vgastate)); par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS; save_vga(&par->state); } - atomic_inc(&par->ref_count); + par->ref_count++; + mutex_unlock(&par->open_lock); + return 0; } @@ -572,14 +573,18 @@ static int neofb_release(struct fb_info *info, int user) { struct neofb_par *par = info->par; - int cnt = atomic_read(&par->ref_count); - if (!cnt) + mutex_lock(&par->open_lock); + if (!par->ref_count) { + mutex_unlock(&par->open_lock); return -EINVAL; - if (cnt == 1) { + } + if (par->ref_count == 1) { restore_vga(&par->state); } - atomic_dec(&par->ref_count); + par->ref_count--; + mutex_unlock(&par->open_lock); + return 0; } @@ -2048,6 +2053,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st info->fix.accel = id->driver_data; + mutex_init(&par->open_lock); par->pci_burst = !nopciburst; par->lcd_stretch = !nostretch; par->libretto = libretto;