shithub: riscv

Download patch

ref: 940e3165d31370871e66e0ae2cce13f010cb26ba
parent: 548a48d1561dd77dbc082dddf0f9a2776ee91914
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 3 08:10:27 EDT 2022

imx8: less stupid pci interrupt handler

--- a/sys/src/9/imx8/pciimx.c
+++ b/sys/src/9/imx8/pciimx.c
@@ -248,7 +248,7 @@
 {
 	Ctlr *ctlr = arg;
 	Intvec *vec;
-	u32int status, mask;
+	u32int status;
 
 	status = ctlr->dbi[MSI_CTRL_INT_0_STATUS];
 	if(status == 0)
@@ -256,8 +256,8 @@
 	ctlr->dbi[MSI_CTRL_INT_0_STATUS] = status;
 
 	ilock(ctlr);
-	for(vec = ctlr->vec, mask = 1; vec < &ctlr->vec[nelem(ctlr->vec)]; vec++, mask <<= 1){
-		if((status & mask) != 0 && vec->f != nil)
+	for(vec = ctlr->vec; status != 0 && vec < &ctlr->vec[nelem(ctlr->vec)]; vec++, status >>= 1){
+		if((status & 1) != 0 && vec->f != nil)
 			(*vec->f)(ureg, vec->a);
 	}
 	iunlock(ctlr);