/* Set the fan speed (off, low, high). Returns the new fan status.  */
static int i8k_set_fan(int fan, int speed)
/* Set the fan speed (off, low, high). Returns the new fan status.  */
static int i8k_set_fan(int fan, int speed)
{
	struct smm_regs regs = { .eax = I8K_SMM_SET_FAN, };
	speed = (speed < 0) ? 0 : ((speed > I8K_FAN_MAX) ? I8K_FAN_MAX : speed);
	regs.ebx = (fan & 0xff) | (speed << 8);
	return i8k_smm(&regs) ? : i8k_get_fan_status(fan);
}