MdeModulePkg XhciDxe: Extract new XhciInsertAsyncIntTransfer function

V3:
Match function parameter name and description between
XhciSched.c and XhciSched.h.

V2:
Add the missing "FreePool (Data);".
Remove the unnecessary indentation change.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1274

Extract new XhciInsertAsyncIntTransfer function from
XhcAsyncInterruptTransfer.

It is code preparation for following patch,
no essential functional change.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Star Zeng
2018-10-22 16:29:03 +08:00
parent a6eb94eedb
commit 6681582dcc
3 changed files with 94 additions and 17 deletions

View File

@@ -1346,7 +1346,6 @@ XhcAsyncInterruptTransfer (
EFI_STATUS Status;
UINT8 SlotId;
UINT8 Index;
UINT8 *Data;
EFI_TPL OldTpl;
//
@@ -1413,36 +1412,21 @@ XhcAsyncInterruptTransfer (
goto ON_EXIT;
}
Data = AllocateZeroPool (DataLength);
if (Data == NULL) {
DEBUG ((EFI_D_ERROR, "XhcAsyncInterruptTransfer: failed to allocate buffer\n"));
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
Urb = XhcCreateUrb (
Urb = XhciInsertAsyncIntTransfer (
Xhc,
DeviceAddress,
EndPointAddress,
DeviceSpeed,
MaximumPacketLength,
XHC_INT_TRANSFER_ASYNC,
NULL,
Data,
DataLength,
CallBackFunction,
Context
);
if (Urb == NULL) {
DEBUG ((EFI_D_ERROR, "XhcAsyncInterruptTransfer: failed to create URB\n"));
FreePool (Data);
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
InsertHeadList (&Xhc->AsyncIntTransfers, &Urb->UrbList);
//
// Ring the doorbell
//