shithub: riscv

Download patch

ref: c9461323f7e6c51a0ee6be9d7893156fce847852
parent: 14c8343e86d3dfe01c939df550846741c2c9c31b
author: mia soweli <inbox@tachibana-labs.org>
date: Fri May 26 10:45:16 EDT 2023

aux/acpi: no need to require the embedded controller.

acpi does not require the machine to have an embedded controller,
stop requiring it to allow using aux/acpi for shutdown on machines
without one.

tested on my dell r520.

--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -459,8 +459,7 @@
 	}ARGEND
 
 	if((ec = open("/dev/ec", ORDWR)) < 0)
-		if((ec = open("#P/ec", ORDWR)) < 0)
-			goto fail;
+		ec = open("#P/ec", ORDWR);
 	if((mem = open("/dev/acpimem", ORDWR)) < 0)
 		mem = open("#P/acpimem", ORDWR);
 	if((iofd[1] = open("/dev/iob", ORDWR)) < 0)
@@ -618,8 +617,8 @@
 {
 	switch(io->space){
 	case EbctlSpace:
-		io->read = readec;
-		io->write = writeec;
+		io->read = ec >= 0 ? readec : dummy;
+		io->write = ec >= 0 ? writeec : dummy;
 		break;
 	case IoSpace:
 		io->read = readio;