/* Activate or deactive power management on either a specific device or the entire system (APM_DEVICE_ALL).  */
static int apm_engage_power_management(u_short device, int enable)
/* Activate or deactive power management on either a specific device or the entire system (APM_DEVICE_ALL).  */
static int apm_engage_power_management(u_short device, int enable)
{
	u32 eax;
	int err;
	if ((enable == 0) && (device == APM_DEVICE_ALL)
	    && (apm_info.bios.flags & APM_BIOS_DISABLED))
		return APM_DISABLED;
	if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, enable,
				 &eax, &err))
		return err;
	if (device == APM_DEVICE_ALL) {
		if (enable)
			apm_info.bios.flags &= ~APM_BIOS_DISENGAGED;
		else
			apm_info.bios.flags |= APM_BIOS_DISENGAGED;
	}
	return APM_SUCCESS;
}