info.hi_ireqfreq = hpet_time_div(hpetp, devp->hd_ireqfreq); 
if (devp->hd_ireqfreq) info.hi_ireqfreq = hpet_time_div(hpetp, devp->hd_ireqfreq); else info.hi_ireqfreq = 0; 
hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel){	struct hpet_timer __iomem *timer;	struct hpet __iomem *hpet;	struct hpets *hpetp;	int err;	unsigned long v;	switch (cmd) {	case HPET_IE_OFF:	case HPET_INFO:	case HPET_EPI:	case HPET_DPI:	case HPET_IRQFREQ:		timer = devp->hd_timer;		hpet = devp->hd_hpet;		hpetp = devp->hd_hpets;		break;	case HPET_IE_ON:		return hpet_ioctl_ieon(devp);	default:		return -EINVAL;	}	err = 0;	switch (cmd) {	case HPET_IE_OFF:		if ((devp->hd_flags & HPET_IE) == 0)			break;		v = readq(&timer->hpet_config);		v &= ~Tn_INT_ENB_CNF_MASK;		writeq(v, &timer->hpet_config);		if (devp->hd_irq) {			free_irq(devp->hd_irq, devp);			devp->hd_irq = 0;		}		devp->hd_flags ^= HPET_IE;		break;	case HPET_INFO:		{			struct hpet_info info;			info.hi_ireqfreq = hpet_time_div(hpetp,							 devp->hd_ireqfreq);			info.hi_flags =			    readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;			info.hi_hpet = devp->hd_hpets->hp_which;			info.hi_timer = devp - devp->hd_hpets->hp_dev;			if (kernel)				memcpy((void *)arg, &info, sizeof(info));			else				if (copy_to_user((void __user *)arg, &info,						 sizeof(info)))					err = -EFAULT;			break;		}	case HPET_EPI:		v = readq(&timer->hpet_config);		if ((v & Tn_PER_INT_CAP_MASK) == 0) {			err = -ENXIO;			break;		}		devp->hd_flags |= HPET_PERIODIC;		break;	case HPET_DPI:		v = readq(&timer->hpet_config);		if ((v & Tn_PER_INT_CAP_MASK) == 0) {			err = -ENXIO;			break;		}		if (devp->hd_flags & HPET_PERIODIC &&		    readq(&timer->hpet_config) & Tn_TYPE_CNF_MASK) {			v = readq(&timer->hpet_config);			v ^= Tn_TYPE_CNF_MASK;			writeq(v, &timer->hpet_config);		}		devp->hd_flags &= ~HPET_PERIODIC;		break;	case HPET_IRQFREQ:		if (!kernel && (arg > hpet_max_freq) &&		    !capable(CAP_SYS_RESOURCE)) {			err = -EACCES;			break;		}		if (!arg) {			err = -EINVAL;			break;		}		devp->hd_ireqfreq = hpet_time_div(hpetp, arg);	}	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/af95eade68da4dfa29c5b64d79cffc9709facf00/hpet.c/clean/drivers/char/hpet.c