[USBPORT] Type-safe function signature (PVOID -> PUSBPORT_xxx).

This commit is contained in:
Vadim Galyant 2017-11-23 20:14:06 +09:00 committed by Thomas Faber
parent a913501626
commit 73bfc3c897
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
5 changed files with 89 additions and 84 deletions

View file

@ -1524,7 +1524,7 @@ USBPORT_RestoreDevice(IN PDEVICE_OBJECT FdoDevice,
PUSBPORT_DEVICE_EXTENSION FdoExtension;
PLIST_ENTRY iHandleList;
PUSBPORT_ENDPOINT Endpoint;
ULONG EndpointRequirements[2] = {0};
USBPORT_ENDPOINT_REQUIREMENTS EndpointRequirements = {0};
USB_DEFAULT_PIPE_SETUP_PACKET SetupPacket;
NTSTATUS Status = STATUS_SUCCESS;
USBD_STATUS USBDStatus;
@ -1707,7 +1707,7 @@ USBPORT_RestoreDevice(IN PDEVICE_OBJECT FdoDevice,
Packet->QueryEndpointRequirements(FdoExtension->MiniPortExt,
&Endpoint->EndpointProperties,
EndpointRequirements);
&EndpointRequirements);
KeReleaseSpinLock(&FdoExtension->MiniportSpinLock,
OldIrql);

View file

@ -620,7 +620,7 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
UCHAR Direction;
UCHAR Interval;
UCHAR Period;
ULONG TransferParams[2] = {0};
USBPORT_ENDPOINT_REQUIREMENTS EndpointRequirements = {0};
PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer;
MPSTATUS MpStatus;
USBD_STATUS USBDStatus;
@ -832,27 +832,27 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
Packet->QueryEndpointRequirements(FdoExtension->MiniPortExt,
&Endpoint->EndpointProperties,
TransferParams);
&EndpointRequirements);
KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
if ((EndpointProperties->TransferType == USBPORT_TRANSFER_TYPE_BULK) ||
(EndpointProperties->TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT))
{
EndpointProperties->MaxTransferSize = TransferParams[1];
EndpointProperties->MaxTransferSize = EndpointRequirements.MaxTransferSize;
}
if (TransferParams[0])
if (EndpointRequirements.HeaderBufferSize)
{
HeaderBuffer = USBPORT_AllocateCommonBuffer(FdoDevice,
TransferParams[0]);
EndpointRequirements.HeaderBufferSize);
}
else
{
HeaderBuffer = NULL;
}
if (HeaderBuffer || (TransferParams[0] == 0))
if (HeaderBuffer || (EndpointRequirements.HeaderBufferSize == 0))
{
Endpoint->HeaderBuffer = HeaderBuffer;
@ -969,7 +969,7 @@ USBPORT_ReopenPipe(IN PDEVICE_OBJECT FdoDevice,
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer;
ULONG EndpointRequirements[2] = {0};
USBPORT_ENDPOINT_REQUIREMENTS EndpointRequirements = {0};
PUSBPORT_REGISTRATION_PACKET Packet;
KIRQL MiniportOldIrql;
NTSTATUS Status;
@ -1013,21 +1013,21 @@ USBPORT_ReopenPipe(IN PDEVICE_OBJECT FdoDevice,
Packet->QueryEndpointRequirements(FdoExtension->MiniPortExt,
&Endpoint->EndpointProperties,
EndpointRequirements);
&EndpointRequirements);
KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, MiniportOldIrql);
if (EndpointRequirements[0])
if (EndpointRequirements.HeaderBufferSize)
{
HeaderBuffer = USBPORT_AllocateCommonBuffer(FdoDevice,
EndpointRequirements[0]);
EndpointRequirements.HeaderBufferSize);
}
else
{
HeaderBuffer = NULL;
}
if (HeaderBuffer || EndpointRequirements[0] == 0)
if (HeaderBuffer || EndpointRequirements.HeaderBufferSize == 0)
{
Endpoint->HeaderBuffer = HeaderBuffer;
Status = STATUS_SUCCESS;

View file

@ -170,7 +170,7 @@ USBPORT_RootHubClassCommand(IN PDEVICE_OBJECT FdoDevice,
case USB_REQUEST_CLEAR_FEATURE:
Feature = SetupPacket->wValue.W;
if ((SetupPacket->bmRequestType.Recipient) != USBPORT_RECIPIENT_ROOT_PORT)
if ((SetupPacket->bmRequestType.Recipient) != USBPORT_RECIPIENT_PORT)
{
if (Feature == FEATURE_C_HUB_LOCAL_POWER)
{
@ -242,7 +242,7 @@ USBPORT_RootHubClassCommand(IN PDEVICE_OBJECT FdoDevice,
break;
case USB_REQUEST_SET_FEATURE:
if (SetupPacket->bmRequestType.Recipient != USBPORT_RECIPIENT_ROOT_PORT)
if (SetupPacket->bmRequestType.Recipient != USBPORT_RECIPIENT_PORT)
{
return RHStatus;
}

View file

@ -30,8 +30,8 @@
#define USBD_TRANSFER_DIRECTION 0x00000001
#endif
#define USBPORT_RECIPIENT_ROOT_HUB BMREQUEST_TO_DEVICE
#define USBPORT_RECIPIENT_ROOT_PORT BMREQUEST_TO_OTHER
#define USBPORT_RECIPIENT_HUB BMREQUEST_TO_DEVICE
#define USBPORT_RECIPIENT_PORT BMREQUEST_TO_OTHER
#define INVALIDATE_ENDPOINT_ONLY 0
#define INVALIDATE_ENDPOINT_WORKER_THREAD 1