mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-07 09:41:30 +00:00
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:
@@ -336,7 +336,7 @@ umouse_request(void *scarg, struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->data[idx].stat = USB_BLOCK_HANDLED;
|
||||
idx = (idx + 1) % USB_MAX_XFER_BLOCKS;
|
||||
idx = index_inc(idx, USB_MAX_XFER_BLOCKS);
|
||||
}
|
||||
|
||||
err = USB_ERR_NORMAL_COMPLETION;
|
||||
@@ -716,7 +716,7 @@ umouse_data_handler(void *scarg, struct usb_xfer *xfer, int dir,
|
||||
|
||||
data->stat = USB_BLOCK_HANDLED;
|
||||
data = NULL;
|
||||
idx = (idx + 1) % USB_MAX_XFER_BLOCKS;
|
||||
idx = index_inc(idx, USB_MAX_XFER_BLOCKS);
|
||||
}
|
||||
if (!data)
|
||||
goto done;
|
||||
|
||||
Reference in New Issue
Block a user