val = i8k_get_fan_status(val); break; 
static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,		     unsigned long arg){    int val;    int speed;    unsigned char buff[16];    int __user *argp = (int __user *)arg;    if (!argp)	return -EINVAL;    switch (cmd) {    case I8K_BIOS_VERSION:	val = i8k_get_bios_version();	break;    case I8K_MACHINE_ID:	memset(buff, 0, 16);	val = i8k_get_serial_number(buff);	break;    case I8K_FN_STATUS:	val = i8k_get_fn_status();	break;    case I8K_POWER_STATUS:	val = i8k_get_power_status();	break;    case I8K_GET_TEMP:	val = i8k_get_cpu_temp();	break;    case I8K_GET_SPEED:	if (copy_from_user(&val, argp, sizeof(int))) {	    return -EFAULT;	}	val = i8k_get_fan_speed(val);	break;    case I8K_GET_FAN:	if (copy_from_user(&val, argp, sizeof(int))) {	    return -EFAULT;	}	val = i8k_get_fan_status(val);	break;    case I8K_SET_FAN:	if (restricted && !capable(CAP_SYS_ADMIN)) {	    return -EPERM;	}	if (copy_from_user(&val, argp, sizeof(int))) {	    return -EFAULT;	}	if (copy_from_user(&speed, argp+1, sizeof(int))) {	    return -EFAULT;	}	val = i8k_set_fan(val, speed);	break;    default:	return -EINVAL;    }    if (val < 0) {	return val;    }    switch (cmd) {    case I8K_BIOS_VERSION:	if (copy_to_user(argp, &val, 4)) {	    return -EFAULT;	}	break;    case I8K_MACHINE_ID:	if (copy_to_user(argp, buff, 16)) {	    return -EFAULT;	}	break;    default:	if (copy_to_user(argp, &val, sizeof(int))) {	    return -EFAULT;	}	break;    }    return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/dec63ec32ea486ab915138e8790084c22a3f7bf6/i8k.c/clean/drivers/char/i8k.c