diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-29 01:12:32 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-29 01:12:32 +0200 |
commit | cd108e2f0b45fd44503528e210d82e47acceebe7 (patch) | |
tree | 83222e6d8ab93d3046171f2f4c87886b25123134 /sys/src | |
parent | c74538a67e57ab9e37826104210d1c1f64711a04 (diff) |
usbxhci: simplify xecp()
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/9/pc/usbxhci.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/src/9/pc/usbxhci.c b/sys/src/9/pc/usbxhci.c index 4851368c8..c23ee0a66 100644 --- a/sys/src/9/pc/usbxhci.c +++ b/sys/src/9/pc/usbxhci.c @@ -317,22 +317,20 @@ xecp(Ctlr *ctlr, uchar id, u32int *p) { u32int x; - if(p != nil) { - x = *p; - goto Next; - } - 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; + if(p == nil){ + p = ctlr->mmio; + x = ctlr->hccparams>>16; + } else + x = (*p>>8) & 255; + while(x != 0){ p += x; + x = *p; + if((x & 255) == id) + return p; + x >>= 8; + x &= 255; } - return p; + return nil; } static void |