shithub: riscv

Download patch

ref: cd108e2f0b45fd44503528e210d82e47acceebe7
parent: c74538a67e57ab9e37826104210d1c1f64711a04
author: cinap_lenrek <[email protected]>
date: Fri Jul 28 21:12:32 EDT 2017

usbxhci: simplify xecp()

--- a/sys/src/9/pc/usbxhci.c
+++ b/sys/src/9/pc/usbxhci.c
@@ -317,22 +317,20 @@
 {
 	u32int x;
 
-	if(p != nil) {
+	if(p == nil){
+		p = ctlr->mmio;
+		x = ctlr->hccparams>>16;
+	} else
+		x = (*p>>8) & 255;
+	while(x != 0){
+		p += x;
 		x = *p;
-		goto Next;
+		if((x & 255) == id)
+			return p;
+		x >>= 8;
+		x &= 255;
 	}
-	x = ctlr->hccparams>>16;
-	if(x == 0)
-		return nil;
-	p = ctlr->mmio + x;
-	while(((x = *p) & 255) != id){
-	Next:
-		x >>= 8, x &= 255;
-		if(x == 0)
-			return nil;
-		p += x;
-	}
-	return p;
+	return nil;
 }
 
 static void