if(sisfb_CheckVBRetrace(ivideo)) { 
if(sisfb_CheckVBRetrace(ivideo)) 
sisfb_ioctl(struct inode *inode, struct file *file,            unsigned int cmd, unsigned long arg,#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	    int con,#endif	    struct fb_info *info){	struct sis_video_info	*ivideo = (struct sis_video_info *)info->par;	struct sis_memreq 	sismemreq;	struct fb_vblank  	sisvbblank;	sisfb_info        	x;	u32			gpu32 = 0;#ifndef __user#define __user#endif	u32 __user 		*argp = (u32 __user *)arg;	switch (cmd) {	   case FBIO_ALLOC:		if(!capable(CAP_SYS_RAWIO)) {			return -EPERM;		}		if(copy_from_user(&sismemreq, (void __user *)arg, sizeof(sismemreq))) {		   	return -EFAULT;		}		sis_malloc(&sismemreq);		if(copy_to_user((void __user *)arg, &sismemreq, sizeof(sismemreq))) {			sis_free((u32)sismemreq.offset);		    	return -EFAULT;		}		break;	   case FBIO_FREE:		if(!capable(CAP_SYS_RAWIO)) {			return -EPERM;		}		if(get_user(gpu32, argp)) {			return -EFAULT;		}		sis_free(gpu32);		break;	   case FBIOGET_VBLANK:		sisvbblank.count = 0;		sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount);		if(copy_to_user((void __user *)arg, &sisvbblank, sizeof(sisvbblank))) {			return -EFAULT;		}		break;	   case SISFB_GET_INFO_SIZE:	        return put_user(sizeof(sisfb_info), argp);	   case SISFB_GET_INFO_OLD:	        if(ivideo->warncount++ < 50) {	           printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");		}	   case SISFB_GET_INFO:  /* For communication with X driver */		x.sisfb_id         = SISFB_ID;		x.sisfb_version    = VER_MAJOR;		x.sisfb_revision   = VER_MINOR;		x.sisfb_patchlevel = VER_LEVEL;		x.chip_id = ivideo->chip_id;		x.memory = ivideo->video_size / 1024;		x.heapstart = ivideo->heapstart / 1024;		if(ivideo->modechanged) {		   x.fbvidmode = ivideo->mode_no;		} else {		   x.fbvidmode = ivideo->modeprechange;		}		x.sisfb_caps = ivideo->caps;		x.sisfb_tqlen = 512; /* yet fixed */		x.sisfb_pcibus = ivideo->pcibus;		x.sisfb_pcislot = ivideo->pcislot;		x.sisfb_pcifunc = ivideo->pcifunc;		x.sisfb_lcdpdc = ivideo->detectedpdc;		x.sisfb_lcdpdca = ivideo->detectedpdca;		x.sisfb_lcda = ivideo->detectedlcda;		x.sisfb_vbflags = ivideo->vbflags;		x.sisfb_currentvbflags = ivideo->currentvbflags;		x.sisfb_scalelcd = ivideo->SiS_Pr.UsePanelScaler;		x.sisfb_specialtiming = ivideo->SiS_Pr.SiS_CustomT;		x.sisfb_haveemi = ivideo->SiS_Pr.HaveEMI ? 1 : 0;		x.sisfb_haveemilcd = ivideo->SiS_Pr.HaveEMILCD ? 1 : 0;		x.sisfb_emi30 = ivideo->SiS_Pr.EMI_30;		x.sisfb_emi31 = ivideo->SiS_Pr.EMI_31;		x.sisfb_emi32 = ivideo->SiS_Pr.EMI_32;		x.sisfb_emi33 = ivideo->SiS_Pr.EMI_33;		x.sisfb_tvxpos = (u16)(ivideo->tvxpos + 32);		x.sisfb_tvypos = (u16)(ivideo->tvypos + 32);		if(copy_to_user((void __user *)arg, &x, sizeof(x))) {			return -EFAULT;		}	        break;	   case SISFB_GET_VBRSTATUS_OLD:	   	if(ivideo->warncount++ < 50) {	           printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");		}	   case SISFB_GET_VBRSTATUS:	        if(sisfb_CheckVBRetrace(ivideo)) {			return put_user((u32)1, argp);		} else {			return put_user((u32)0, argp);		}	   case SISFB_GET_AUTOMAXIMIZE_OLD:	   	if(ivideo->warncount++ < 50) {	           printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");		}	   case SISFB_GET_AUTOMAXIMIZE:	        if(ivideo->sisfb_max)	return put_user((u32)1, argp);		else			return put_user((u32)0, argp);	   case SISFB_SET_AUTOMAXIMIZE_OLD:	   	if(ivideo->warncount++ < 50) {		   printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");		}	   case SISFB_SET_AUTOMAXIMIZE:		if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {			return -EFAULT;		}		ivideo->sisfb_max = (gpu32) ? 1 : 0;		break;	   case SISFB_SET_TVPOSOFFSET:		if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {			return -EFAULT;		}		sisfb_set_TVxposoffset(ivideo, ((int)(gpu32 >> 16)) - 32);		sisfb_set_TVyposoffset(ivideo, ((int)(gpu32 & 0xffff)) - 32);		break;	   case SISFB_GET_TVPOSOFFSET:	        return put_user((u32)(((ivideo->tvxpos+32)<<16)|((ivideo->tvypos+32)&0xffff)),				argp);	   case SISFB_SET_LOCK:		if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {			return -EFAULT;		}		ivideo->sisfblocked = (gpu32) ? 1 : 0;		break;	   default:		return -ENOIOCTLCMD;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/544393fe584d333480659a4bed30f5295355df11/sis_main.c/clean/drivers/video/sis/sis_main.c