DM USB: introduce helper functions: index_inc and index_valid

Introduce helper functions to make code shorter and cleaner.

Tracked-On: #3628
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu
2019-09-09 18:18:56 +08:00
committed by wenlingz
parent d58a766556
commit 1352eca224
5 changed files with 41 additions and 43 deletions

View File

@@ -118,7 +118,7 @@ usb_block_append(struct usb_xfer *xfer, void *buf, int blen,
xb->bdone = 0;
xb->type = USB_DATA_NONE;
xfer->ndata++;
xfer->tail = (xfer->tail + 1) % USB_MAX_XFER_BLOCKS;
xfer->tail = index_inc(xfer->tail, USB_MAX_XFER_BLOCKS);
return xb;
}