Fix logic in Optimus DSM execution

common-wmi
Lekensteyn 13 years ago
parent a62634d9fe
commit 73966cbddd

@ -141,17 +141,19 @@ static int has_dsm_func(const char muid[16], int revid, int sfnc) {
} }
static int bbswitch_optimus_dsm(void) { static int bbswitch_optimus_dsm(void) {
if (dsm_type == DSM_TYPE_OPTIMUS) {
char args[] = {1, 0, 0, 3}; char args[] = {1, 0, 0, 3};
u32 result = 0; u32 result = 0;
if (acpi_call_dsm(dis_handle, acpi_optimus_dsm_muid, 0x100, 0x1A, args, if (acpi_call_dsm(dis_handle, acpi_optimus_dsm_muid, 0x100, 0x1A, args,
&result)) { &result)) {
// failure
return 1;
}
printk(KERN_DEBUG "bbswitch: Result of Optimus _DSM call: %08X\n", printk(KERN_DEBUG "bbswitch: Result of Optimus _DSM call: %08X\n",
result); result);
return 0;
} }
// failure return 0;
return 1;
} }
static int bbswitch_acpi_off(void) { static int bbswitch_acpi_off(void) {
@ -211,9 +213,9 @@ static void bbswitch_off(void) {
printk(KERN_INFO "bbswitch: disabling discrete graphics\n"); printk(KERN_INFO "bbswitch: disabling discrete graphics\n");
if (dsm_type == DSM_TYPE_OPTIMUS && bbswitch_optimus_dsm()) { if (bbswitch_optimus_dsm()) {
printk(KERN_WARNING "bbswitch: ACPI call failed, the device is not" printk(KERN_WARNING "bbswitch: Optimus ACPI call failed, the device is"
" disabled\n"); " not disabled\n");
return; return;
} }

Loading…
Cancel
Save