X-Git-Url: http://git.agner.ch/gitweb/?a=blobdiff_plain;f=drivers%2Fvideo%2Fneofb.c;h=395ccedde9a63b5718afdefb34d3f3c4f7235db8;hb=7baca6ad0ef09c8a78d798c93a3ce25336e8f50f;hp=59a6f5fa5ae64992a25dee1357917ccfe8785d2c;hpb=826adfe49a508f15943ce9140a3fc7f6c7661509;p=linux-drm-fsl-dcu.git diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 59a6f5fa5ae6..395ccedde9a6 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; } @@ -1932,7 +1937,7 @@ static int __devinit neo_init_hw(struct fb_info *info) printk(KERN_DEBUG "--- Neo extended register dump ---\n"); for (int w = 0; w < 0x85; w++) printk(KERN_DEBUG "CR %p: %p\n", (void *) w, - (void *) vga_rcrt(NULL, w); + (void *) vga_rcrt(NULL, w)); for (int w = 0; w < 0xC7; w++) printk(KERN_DEBUG "GR %p: %p\n", (void *) w, (void *) vga_rgfx(NULL, w)); @@ -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;